[英]mono, c#, sockets, performance
I developed simple async server that listens to unix socket and sync client that send the some small piece of data. 我开发了简单的异步服务器,它可以监听发送一些小数据的unix socket和sync客户端。 Time between moment when i send data from client to the moment when server receives them is completly random, from 1 to 9 seconds.
从客户端发送数据到服务器接收数据的时刻之间的时间是完全随机的,从1到9秒。 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
服务器实现如msdn示例所示(使用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). 从webservice方法(通过xsp2运行)调用将数据发送到服务器的方法。
It occures that unix sockets in mono are ok :). 它发生单声道的unix套接字是好的:)。 I had some threading issues which were completely unrelated to Mono.Unix and unix domain sockets.
我有一些与Mono.Unix和unix域套接字完全无关的线程问题。 Thanks all for your help.
感谢你的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.