mono, c#, sockets, performance

2019-04-09 16:39发布

I developed simple async server that listens to unix socket and sync client that send the some small piece of data. Time between moment when i send data from client to the moment when server receives them is completly random, from 1 to 9 seconds. I wonder why is the reason? Server is implemented as shown in msdn example here (using beginReceive): http://msdn.microsoft.com/en-us/library/fx6588te.aspx

EndPoint ep = new UnixEndPoint(_fileName);
_socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);

try
{
     _socket.Bind(ep);
     _socket.Listen(_maxConnectionsInQuee);

     while(true)
     {
         done.Reset();
         _socket.BeginAccept(new AsyncCallback(AcceptCallback), null);
         done.WaitOne();
     }
}

And in the client:

EndPoint ep = new UnixEndPoint(_fileName);
_socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);
_socket.Connect(ep);
byte[] bytes = Encoding.UTF8.GetBytes(message);
_socket.Send(bytes);

Method that sends data to the server is called from webservice method (running via xsp2).

1条回答
再贱就再见
2楼-- · 2019-04-09 17:33

It occures that unix sockets in mono are ok :). I had some threading issues which were completely unrelated to Mono.Unix and unix domain sockets. Thanks all for your help.

查看更多
登录 后发表回答