Linked Questions
16 questions linked to/from socket.shutdown vs socket.close
11 votes
2 answers
13k views
How can I pass a socket from parent to child processes
I'm stuck on a problem in a C program on Linux. I know that when a processes is forked the child process inherits some things from the parent, including open file descriptors. The problem is that I'...
8 votes
4 answers
36k views
How can I implement a simple web server using Python without using any libraries?
I need to implement a very simple web-server-like app in Python which would perform basic HTTP requests and responses and display very basic output on the web page. I am not too concerned about ...
2 votes
3 answers
12k views
Java, server client TCP communication ends with RST
I'm trying to figure out if this is normal. Because without errors, a connection should be terminated by: FIN -> <- ACK <- FIN ACK -> I get this at the end of a TCP connection (over SSL, ...
3 votes
2 answers
14k views
How can I test TCP socket status in Perl?
I've got a TCP socket which reads data. When an error occurs when reading the data, I return an undef (NULL) value. Errors can be caused by badly formatted messages or broken sockets. Can someone tell ...
5 votes
6 answers
4k views
Avoid reusing of the same fd number in a multithread socket application
I have an asynchronous application executing several threads doing operations over sockets where operations are scheduled and then executed asynchronously. I'm trying to avoid a situation when once ...
7 votes
5 answers
2k views
How to shutdown a timed out http POST using urlopen by urllib2 in Python?
Overview I am using urlopen from the Python 2.7.1 urllib2 package to do a HTTP POST form a Windows XP machine to a remote Apache webserver (for instance the built-in web sharing of Mac OS X). The ...
3 votes
2 answers
8k views
Proper way to close tcp sockets in python
I am currently working on a server + client combo on python and I'm using TCP sockets. From networking classes I know, that TCP connection should be closed step by step, first one side sends the ...
2 votes
2 answers
1k views
Berkley sockets shutdown function, how important?
as background I've got an embedded device that talks to a third party server over IP. The code in the third party server is unlikely to change. In a recent release I changed the ip disconnect function ...
1 vote
2 answers
3k views
socket.close(fd) in Python. What does 'fd' mean?
I have this piece of code here: import socket socket.close() I get a warning that socket.close() is missing the 'fd' parameter. What integer should I fill in for general usage, and what do the ...
5 votes
2 answers
610 views
Any cases Where close() is preferred to shutdown()?
I am a developer on an open source project and I have been having some problems with the server thinking it has answered a socket completely (meaning it has either sent a reply or closed it's end in ...
1 vote
3 answers
1k views
socket.sock().bind() Address already in use
I am trying to build a simple server-client model to do the file transfer task. My server.py and client.py look like this: <Server.py> import socket s = socket.socket() host = socket....
0 votes
1 answer
1k views
Gracefully stop socket during blocking call to socket.recv()
I have a program which runs on 2 threads. The main thread is for its own work and the other thread keeps calling recv() on a UDP socket. Basically, the code structure looks like this: done = False ...
2 votes
1 answer
723 views
Socket.Shutdown and threads
I'm pretty new to socket programming. Our application uses sockets to communicate with a device our company manufactures. We have a problem with the socket sometimes taking a long time to close. ...
0 votes
1 answer
389 views
What will happen to the socket if select timeout
On the basis of shutdown vs close I have known the difference between shutdown and close. But which will choose if select timeout in socket, the client will close or shutdown(sock, SHUT_WR). I try to ...
1 vote
1 answer
383 views
Network resources for TCP connections in python [Windows]
Not sure if I have myself a problem with a python script I'm using. Basically, it spawns threads, each creating a tcp connections. Well the script finishes, i even check if any threads are still ...