Questions tagged [closesocket]

11 questions
11
votes
2 answers

Whats the difference between a socket which is open and a socket which is connected?

The Java Socket class has two methods isClosed and isConnected to check whether the socket is closed or connected respectively. I wanted to know what's the difference between a TCP socket which is only open and a TCP socket which is open and…
Aadit M Shah
  • 67,342
  • 26
  • 146
  • 271
6
votes
3 answers

recv() returns 0

I have a very annoying problem that I found several times on other forums but I can't find a proper solution. The problem is recv() returns 0 on the last few bytes of a connection. Here are some background information. Both (client / server)…
HelloWorld
  • 2,938
  • 1
  • 22
  • 47
4
votes
2 answers

tcp closesocket method of winsock generating reset (RST)

Windows socket close(closesocket) function generates RST. On linux when I call close function to close a tcp socket it goes through fin/ack from both client server and the socket gets closed. But on windows winsock, whenever i call closesocket it…
3
votes
1 answer

WinSock closesocket() call takes one second on some computers

This call should return after only a very short time, but on some machines it inexplicably takes very close to 1 second. Has anyone seen this issue. I am using the loopback address so the network should be out of the picture.
Jesse Pepper
  • 3,182
  • 25
  • 45
2
votes
1 answer

Does TCP close( ) ensure that all the data is delivered to the receiver

I am implementing a simple proxy application in which I always receive data from one end and send to the other end. In such a case, once I am sure that I am done with receiving all the data from the incoming leg, can I call directly close( ) without…
2
votes
0 answers

Determining the moment a TCP connection is really been closed in C

I need to perform some operations only after the time a TCP connection is fully closed, that's to say - all the data segments, as well as the finishing routine (FIN-ACK or RST) have been performed and done, and no packets will be sent on the…
Reflection
  • 1,718
  • 2
  • 17
  • 33
1
vote
0 answers

What should I do if closesocket fails with WSAENETDOWN?

Apparently, whenever the closesocket function fails with WSAENETDOWN, “The network subsystem has failed”. But what exactly does that mean? When does it happen? If it does happen, is the socket descriptor still closed? How should I handle…
purefanatic
  • 762
  • 1
  • 7
  • 19
0
votes
1 answer

closesocket() not completing pending operations of IOCP

I am currently working on a server application in C++. My main inspirations are these examples: Windows SDK IOCP Excample The I/O Completion Port IPv4/IPv6 Server Program Example My app is strongly similar to these (socketobj, packageobj, ...). In…
Woife
  • 15
  • 7
0
votes
0 answers

socket c-sharp send data without close and shutdown like BufferedWriter.flush in java

i can't receive message while not close socket and i use NetworkStream but while socket not closed not send data my code server c#: newsocket = serversocket.AcceptSocket(); newsocket.Send(dataSend); …
0
votes
1 answer

closesocket() call on socket in windows takes 20 sec

I'm trying to close socket on windows from closesocket(), but it takes 20 sec to complete. at first I thought it was about linger interval, although I was not setting anything with setsockopt by linger, so I added such code: linjer…
Zhani Baramidze
  • 1,248
  • 11
  • 29
0
votes
0 answers

IOCP close socket and delete per io related buffer

Trying to stop IOCP worker thread and close socket and related per io datums This is based on reference counting and when ref count reach 0, close socket and delete buffers. Below is skeleton of IOCP worker thread. When I want to stop IO , call…
Mark Yang
  • 209
  • 3
  • 15