Example #1
0
        private static void send_caller(object thread_param)
        {
            object[] param_arr = thread_param as object[];
            Socket   from_sock = param_arr[0] as Socket;
            Socket   to_sock   = param_arr[1] as Socket;

            try
            {
                recv_and_send(from_sock, to_sock, bytes =>
                {
                    stat_obj stat     = _stat_info[(int)param_arr[2]];
                    stat._bytes_send += bytes;
                });
            }
            catch (Exception exp)
            {
                _l4n.Info(exp.Message);
            }
            finally
            {
                try
                {
                    from_sock.Shutdown(SocketShutdown.Both);
                    to_sock.Shutdown(SocketShutdown.Both);
                    from_sock.Dispose();
                    to_sock.Dispose();
                }
                catch (Exception) { }
            }
        }
Example #2
0
        private static void recv_and_send_caller(object thread_param)
        {
            object[] param_arr = thread_param as object[];
            Socket   sock1     = param_arr[0] as Socket;
            Socket   sock2     = param_arr[1] as Socket;

            try
            {
                recv_and_send(sock1, sock2, bytes =>
                {
                    stat_obj stat = _stat_info[(int)param_arr[2]];
                    if ((bool)param_arr[3])
                    {
                        stat._bytes_send += bytes;
                    }
                    else
                    {
                        stat._bytes_recv += bytes;
                    }
                });
            }
            catch (Exception exp)
            {
                _l4n.Info(exp.Message);
                try
                {
                    sock1.Shutdown(SocketShutdown.Both);
                    sock2.Shutdown(SocketShutdown.Both);
                    sock1.Close();
                    sock2.Close();
                }
                catch (Exception) { }
            }
        }
Example #3
0
        private static void recv_caller(object thread_param)
        {
            object[] param_arr       = thread_param as object[];
            Socket   sock_cli_remote = param_arr[0] as Socket;
            Socket   sock_cli        = param_arr[1] as Socket;

            try
            {
                recv_and_send(sock_cli_remote, sock_cli, bytes =>
                {
                    stat_obj stat     = _stat_info[(int)param_arr[2]];
                    stat._bytes_recv += bytes;
                });
            }
            catch (Exception exp)
            {
                _l4n.Info(exp.Message);
                try
                {
                    sock_cli_remote.Shutdown(SocketShutdown.Both);
                    sock_cli.Shutdown(SocketShutdown.Both);
                    sock_cli_remote.Dispose();
                    sock_cli.Dispose();
                }
                catch (Exception) { }
            }
        }