66,418 questions
1164
votes
37
answers
554k
views
What is the difference between a port and a socket?
This was a question raised by one of the Software Engineers in my organisation. I'm interested in the broadest definition.
902
votes
2
answers
408k
views
How do SO_REUSEADDR and SO_REUSEPORT differ?
The man pages and programmer documentations for the socket options SO_REUSEADDR and SO_REUSEPORT are different for different operating systems and often highly confusing. Some operating systems don't ...
465
votes
19
answers
1.4m
views
How do I debug error ECONNRESET in Node.js?
I'm running an Express.js application using Socket.io for a chat webapp
and I get the following error randomly around 5 times during 24h.
The node process is wrapped in forever and it restarts itself ...
361
votes
20
answers
729k
views
Getting the IP address of the current machine using Java
I am trying to develop a system where there are different nodes that are run on different system or on different ports on the same system.
Now all the nodes create a Socket with a target IP as the ...
321
votes
39
answers
1.1m
views
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I am getting the following error when I try to connect to mysql:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Is there a solution for this error? What might be ...
306
votes
5
answers
342k
views
What is AF_INET in socket programming?
I'm getting started on socket programming, and I keep seeing references to something called AF_INET.
Yet, I've never seen anything else used in its place. My lecturers are not that helpful and just ...
269
votes
9
answers
153k
views
What is the Difference Between read() and recv() , and Between send() and write()?
What is the difference between read() and recv(), and between send() and write() in socket programming in terms of performances, speed and other behaviors?
265
votes
9
answers
339k
views
close vs shutdown socket?
In C, I understood that if we close a socket, it means the socket will be destroyed and can be re-used later.
How about shutdown? The description said it closes half of a duplex connection to that ...
253
votes
22
answers
1.1m
views
An existing connection was forcibly closed by the remote host
I am working with a commercial application which is throwing a SocketException with the message,
An existing connection was forcibly closed by the remote host
This happens with a socket connection ...
242
votes
5
answers
208k
views
What is the difference between 127.0.0.1 and localhost
Assuming the following is defined in .../hosts:
127.0.0.1 localhost
What, if any, are the actual differences between using 127.0.0.1 and localhost as the server name, especially when hitting ...
230
votes
18
answers
236k
views
How to find an available port?
I want to start a server which listen to a port. I can specify port explicitly and it works. But I would like to find a port in an automatic way. In this respect I have two questions.
In which range ...
217
votes
6
answers
202k
views
TCP: can two different sockets share a port?
This might be a very basic question but it confuses me.
Can two different connected sockets share a port? I'm writing an application server that should be able to handle more than 100k concurrent ...
192
votes
17
answers
1.3m
views
java.net.SocketException: Connection reset
I am getting the following error trying to read from a socket. I'm doing a readInt() on that InputStream, and I am getting this error. Perusing the documentation suggests that the client part of the ...
178
votes
12
answers
154k
views
IPC performance: Named Pipe vs Socket
Everyone seems to say named pipes are faster than sockets IPC. How much faster are they? I would prefer to use sockets because they can do two-way communication and are very flexible but will choose ...
178
votes
9
answers
17k
views
How to use the C socket API in C++ on z/OS
I'm having issues getting the C sockets API to work properly in C++ on z/OS.
Although I am including sys/socket.h, I still get compile time errors telling me that AF_INET is not defined.
Am I missing ...
173
votes
14
answers
443k
views
Official reasons for "Software caused connection abort: socket write error"
Given this stack trace snippet
Caused by: java.net.SocketException:
Software caused connection abort:
socket write error at
java.net.SocketOutputStream.socketWrite0(Native
Method)
I ...
172
votes
3
answers
116k
views
How much overhead does SSL impose?
I know there's no single hard-and-fast answer, but is there a generic order-of-magnitude estimate approximation for the encryption overhead of SSL versus unencrypted socket communication? I'm talking ...
170
votes
17
answers
441k
views
Python [Errno 98] Address already in use
In my Python socket program, I sometimes need to interrupt it with Ctrl-C. When I do this, it does close the connection using socket.close().
However, when I try to reopen it I have to wait what ...
169
votes
3
answers
94k
views
What's the difference between streams and datagrams in network programming?
What's the difference between sockets (stream) and sockets (datagrams)?
Why use one over the other?
164
votes
6
answers
353k
views
Connecting to TCP Socket from browser using javascript
I have a vb.net application that opens a socket and listens on it.
I need to communicate via this socket to that application using a javascript running on a browser. That is i need to send some data ...
161
votes
14
answers
1.3m
views
What's causing my java.net.SocketException: Connection reset? [duplicate]
We are seeing frequent but intermittent java.net.SocketException: Connection reset errors in our logs. We are unsure as to where the Connection reset error is actually coming from, and how to go ...
149
votes
10
answers
186k
views
Sockets: Discover port availability using Java
How do I programmatically determine the availability of a port in a given machine using Java?
i.e given a port number, determine whether it is already being used or not?.
147
votes
6
answers
100k
views
difference between socket programming and Http programming
What is the difference between socket programming and Http programming? can anyone help please?
146
votes
3
answers
70k
views
Are parallel calls to send/recv on the same socket valid?
Can we call send from one thread and recv from another on the same socket?
Can we call multiple sends parallely from different threads on the same socket?
I know that a good design should avoid this, ...
142
votes
8
answers
144k
views
Interprocess communication in Python
What is a good way to communicate between two separate Python runtimes? Things tried:
reading/writing on named pipes e.g. os.mkfifo (feels hacky)
dbus services (worked on desktop, but too heavyweight ...