views:

286

answers:

1

Hi,

I am working on a sample application which sends file to other device. I have 2 buttons on my window, one is to send and other is to stop file transfer. Send; send the file to destination and Stop: stops the sending process.

When I send the multiple files to destination, all files reach destination properly. But if I click send and stop repeatedly for 3 to 4 times (ie initially I click send then suddenly within no time I click stop. I will continue this process for 3 to 4 times). Then if I try to send the multiple files then, it will send first file and when it send the 2 file I get error #10054 in the function Send().

I am using non-blocking socket by: u_long i = 1; ioctlsocket(sockt, FIONBIO, &i);

in the destructer I am closing the scoket.

please help he to solve this problem.

+1  A: 

First, it seems to me like the problem is on the peer end. It may not manage the connections properly. For instance, there might be more than one connection at the time (more than one active socket, like one stopped lingering and a new one just being created) and the other side program not being aware of that.

Pavel Radzivilovsky
Thanks for the replay,I read that closesocket() doesn’t close the socket immediately after calling the close socket. It just initiates the close operation. How to overcome from this problem.
Umesha MS
This is not a problem. This is normal. Your server should support multiple connections, for exactly this reason.
Pavel Radzivilovsky
Is it is right way to reestablish connection (again create socket and connect) with remote device? If I do it, any problem comes?
Umesha MS