G
Guest
Hi,
I have already started a topic on a problem related to Datagram Socket Speed
Problem, it is at this address
http://msdn.microsoft.com/newsgroup...mobile-wince&lang=en&cr=US&sloc=en-us&m=1&p=1
I am still having problems with that one...
In my application, I am sending data "as fast as possible" into a datagram
socket, which is blocking, and which has a 400 kbyte sendbuffer. The code is
similar to this:
while (keepAlive)
{
byte[] data = dataSource.getData();
int sentData = socket.SendTo(data , 0, dataSize, SocketFlags.None,
remoteEndPoint);
//If I add this line, it is working fine
//Thread.Sleep(50);
}
If the Thread.Sleep() line is commented, the application will crash almost
instantly... I get no exception, no error... the connection with Visual
Studio .NET 2003 is lost, the application is shut down... and the Ipaq
network features are not working any more.. only a soft reset can bring it
back working.
I don't understand why the socket.SendTo() function does not block the
application untill the data is sent... It seems it only copies the data into
an internal buffer, and stupidly crashes when this buffer is full.
If I uncomment the line Thread.Sleep(), then the application is working.
This line is slowing down the application so that the data rate is low enough
for the socket to send it.
Paul G. Tobey tried to help me already. He suggested to check the value
returned by socket.SendTo()... unfortunately this value is always positive
and equals to the size of the byte[] the application is sending. So
everything seems to behave like normal, but it crashes completely....
What can I do to ensure the application is sending the data as fast as
possible ?
And also to be sure it will not crash ?
Thanks a lot for your patience to read this!
Lionel Reyero
I have already started a topic on a problem related to Datagram Socket Speed
Problem, it is at this address
http://msdn.microsoft.com/newsgroup...mobile-wince&lang=en&cr=US&sloc=en-us&m=1&p=1
I am still having problems with that one...
In my application, I am sending data "as fast as possible" into a datagram
socket, which is blocking, and which has a 400 kbyte sendbuffer. The code is
similar to this:
while (keepAlive)
{
byte[] data = dataSource.getData();
int sentData = socket.SendTo(data , 0, dataSize, SocketFlags.None,
remoteEndPoint);
//If I add this line, it is working fine
//Thread.Sleep(50);
}
If the Thread.Sleep() line is commented, the application will crash almost
instantly... I get no exception, no error... the connection with Visual
Studio .NET 2003 is lost, the application is shut down... and the Ipaq
network features are not working any more.. only a soft reset can bring it
back working.
I don't understand why the socket.SendTo() function does not block the
application untill the data is sent... It seems it only copies the data into
an internal buffer, and stupidly crashes when this buffer is full.
If I uncomment the line Thread.Sleep(), then the application is working.
This line is slowing down the application so that the data rate is low enough
for the socket to send it.
Paul G. Tobey tried to help me already. He suggested to check the value
returned by socket.SendTo()... unfortunately this value is always positive
and equals to the size of the byte[] the application is sending. So
everything seems to behave like normal, but it crashes completely....
What can I do to ensure the application is sending the data as fast as
possible ?
And also to be sure it will not crash ?
Thanks a lot for your patience to read this!
Lionel Reyero