Questions tagged [tcp]

Transmission Control Protocol (TCP) is a transport layer protocol that provides a connection-oriented data stream service with delivery that is guaranteed to be in-order.

tcp
Filter by
Sorted by
Tagged with
2110 votes
19 answers
1.8m views

Who is listening on a given TCP port on Mac OS X?

On Linux, I can use netstat -pntl | grep $PORT or fuser -n tcp $PORT to find out which process (PID) is listening on the specified TCP port. How do I get the same information on Mac OS X?
pts's user avatar
  • 84.6k
931 votes
2 answers
1.4m views

What does "connection reset by peer" mean?

What is the meaning of the "connection reset by peer" error on a TCP connection? Is it a fatal error or just a notification or related to the network failure?
Franck Freiburger's user avatar
879 votes
37 answers
1.6m views

How can I connect to Android with ADB over TCP? [closed]

I am attempting to debug an application on a Motorola Droid, but I am having some difficulty connecting to the device via USB. My development server is a Windows 7 64-bit VM running in Hyper-V, and so ...
JDM's user avatar
  • 9,797
465 votes
8 answers
446k views

What is the largest TCP/IP network port number allowable for IPv4?

What is the highest port number one can use?
username's user avatar
  • 19.2k
460 votes
5 answers
402k views

How do multiple clients connect simultaneously to one port, say 80, on a server? [duplicate]

I understand the basics of how ports work. However, what I don't get is how multiple clients can simultaneously connect to say port 80. I know each client has a unique (for their machine) port. Does ...
IamIC's user avatar
  • 18k
448 votes
19 answers
1.2m 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 ...
396 votes
22 answers
224k views

Artificially create a connection timeout error

I've had a bug in our software that occurs when I receive a connection timeout. These errors are very rare (usually when my connection gets dropped by our internal network). How can I generate this ...
Mark Ingram's user avatar
  • 72.7k
381 votes
18 answers
632k views

Test if remote TCP port is open from a shell script

I'm looking for a quick and simple method for properly testing if a given TCP port is open on a remote server, from inside a Shell script. I've managed to do it with the telnet command, and it works ...
Yanick Girouard's user avatar
359 votes
17 answers
400k views

Can two applications listen to the same port?

Can two applications on the same machine bind to the same port and IP address? Taking it a step further, can one app listen to requests coming from a certain IP and the other to another remote IP? I ...
nadiv's user avatar
  • 3,601
342 votes
24 answers
246k views

When is it appropriate to use UDP instead of TCP? [closed]

Since TCP guarantees packet delivery and thus can be considered "reliable", whereas UDP doesn't guarantee anything and packets can be lost. What would be the advantage of transmitting data using UDP ...
Jeff L's user avatar
  • 6,148
302 votes
3 answers
244k views

What is the theoretical maximum number of open TCP connections that a modern Linux box can have

Assuming infinite performance from hardware, can a Linux box support >65536 open TCP connections? I understand that the number of ephemeral ports (<65536) limits the number of connections from one ...
fadedbee's user avatar
  • 43.7k
293 votes
6 answers
250k views

Simulate delayed and dropped packets on Linux

I would like to simulate packet delay and loss for UDP and TCP on Linux to measure the performance of an application. Is there a simple way to do this?
user avatar
249 votes
18 answers
1.4m views

java.net.ConnectException: Connection refused

I'm trying to implement a TCP connection, everything works fine from the server's side but when I run the client program (from client computer) I get the following error: java.net.ConnectException: ...
Samantha Catania's user avatar
234 votes
2 answers
140k views

What is the difference between HTTP 1.1 and HTTP 2.0? [closed]

HTTP/1.1 has served the Web well for more than fifteen years, but its age is starting to show. Can anybody explain what is the main difference between HTTP 1.1 and 2.0? Is there any change in the ...
user avatar
233 votes
10 answers
445k views

Maximum packet size for a TCP connection

What is the maximum packet size for a TCP connection or how can I get the maximum packet size?
Alexa's user avatar
  • 2,361
225 votes
14 answers
276k views

UDP vs TCP, how much faster is it? [closed]

For general protocol message exchange, which can tolerate some packet loss. How much more efficient is UDP over TCP?
Net Citizen's user avatar
  • 5,234
222 votes
2 answers
188k views

Differences between TCP sockets and web sockets, one more time [duplicate]

Trying to understand as best as I can the differences between TCP socket and websocket, I've already found a lot of useful information within these questions: fundamental difference between ...
pierroz's user avatar
  • 7,761
217 votes
4 answers
68k views

What is the fundamental difference between WebSockets and pure TCP?

I've read about WebSockets and I wonder why browser couldn't simply open trivial TCP connection and communicate with server like any other desktop application. And why this communication is possible ...
xap4o's user avatar
  • 2,866
216 votes
11 answers
56k views

Why is SCTP not much used/known

I recently checked out the book "UNIX Network Programming, Vol. 1" by Richards Stevens and I found that there is a third transport layer standard besides TCP and UDP: SCTP. Summary: SCTP is a ...
dmeister's user avatar
  • 35.1k
210 votes
7 answers
190k 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 ...
K J's user avatar
  • 4,623
209 votes
11 answers
459k views

Freeing up a TCP/IP port? [closed]

netstat -tulnap shows me what ports are in use. How to free up a port in Linux?
user avatar
208 votes
8 answers
264k views

NGINX to reverse proxy websockets AND enable SSL (wss://)?

I'm so lost and new to building NGINX on my own but I want to be able to enable secure websockets without having an additional layer. I don't want to enable SSL on the websocket server itself but ...
crockpotveggies's user avatar
191 votes
6 answers
178k views

How do ports work with IPv6?

Conventional IPv4 dotted quad notation separates the address from the port with a colon, as in this example of a webserver on the loopback interface: 127.0.0.1:80 but with IPv6 notation the address ...
Peter Wone's user avatar
  • 18.3k
183 votes
5 answers
378k views

Telnet is not recognized as internal or external command, even after activation [closed]

I am trying to perform port forwarding to connect two emulators using TCP protocol on Windows. Although I have enabled TCP client program from control Panel, "telnet" command is not ...
Nikesh Devaki's user avatar
176 votes
2 answers
225k views

ConnectionTimeout versus SocketTimeout

I'm having a problem with a library that I am using. It might be the library or it might be me using it wrong! Basically, when I do this (Timeout in milliseconds) _ignitedHttp.setConnectionTimeout(1)...
Robert's user avatar
  • 38k
171 votes
7 answers
159k views

How many socket connections can a web server handle?

Say if I was to get shared, virtual or dedicated hosting, I read somewhere a server/machine can only handle 64,000 TCP connections at one time, is this true? How many could any type of hosting handle ...
David's user avatar
  • 2,103
168 votes
8 answers
735k views

Check status of one port on remote host [closed]

I need a command line that can check the port status on a remote host. I tried ping xxx.xxx.xxx.xxx:161 but it doesn't recognize the "host". I thought it was a "good" answer until I did the same ...
user avatar
168 votes
12 answers
707k views

What causes a TCP/IP reset (RST) flag to be sent?

I'm trying to figure out why my app's TCP/IP connection keeps hiccuping every 10 minutes (exactly, within 1-2 seconds). I ran Wireshark and discovered that after 10 minutes of inactivity the other ...
Luke's user avatar
  • 18.8k
166 votes
5 answers
106k views

TCP loopback connection vs Unix Domain Socket performance

Working on an Android and iOS based application which require communication with a server running in the same device. Currently using TCP loopback connection for communicating with App and Server (App ...
Rohit's user avatar
  • 7,031
161 votes
13 answers
146k views

Difference between TCP and UDP?

What is the difference between TCP and UDP? I know that TCP is used in the case of non-time critical applications, and UDP is used for games or applications that require fast transmission of data. I ...
user749414's user avatar
  • 1,627
151 votes
18 answers
72k views

How to write a scalable TCP/IP based server

I am in the design phase of writing a new Windows service application that accepts TCP/IP connections for long running connections (i.e., this is not like HTTP where there are many short connections, ...
Erik Funkenbusch's user avatar
147 votes
21 answers
248k views

In C#, how to check if a TCP port is available?

In C# to use a TcpClient or generally to connect to a socket how can I first check if a certain port is free on my machine? more info: This is the code I use: TcpClient c; //I want to check here if ...
Ali's user avatar
  • 5,376
144 votes
4 answers
57k views

How does the socket API accept() function work?

The socket API is the de-facto standard for TCP/IP and UDP/IP communications (that is, networking code as we know it). However, one of its core functions, accept() is a bit magical. To borrow a semi-...
Eli Bendersky's user avatar
140 votes
7 answers
120k views

HTTP vs TCP/IP, send data to a web server

I'm currently working on a project where I need to use an Arduino Nano (http://arduino.cc/en/Main/arduinoBoardNano) to send data from a temperature sensor to a web server. At first I thought it would ...
Adam's user avatar
  • 9,326
140 votes
3 answers
85k views

Can TCP and UDP sockets use the same port?

First of all, is there any problem with using both UDP and TCP on the same server? Secondly, can I use the same port number?
user800799's user avatar
  • 2,933
135 votes
12 answers
70k views

How should one go about choosing a default TCP/IP port for a new service?

When developing an app that will listen on a TCP/IP port, how should one go about selecting a default port? Assume that this app will be installed on many computers, and that avoiding port conflicts ...
Kevin Wong's user avatar
  • 14.8k
134 votes
5 answers
196k views

Linux: is there a read or recv from socket with timeout?

How can I try to read data from socket with timeout? I know, select, pselect, poll, has a timeout field, but using of them disables "tcp fast-path" in tcp reno stack. The only idea I have is to use ...
osgx's user avatar
  • 91.9k
121 votes
8 answers
177k views

When is TCP option SO_LINGER (0) required?

I think I understand the formal meaning of the option. In some legacy code I'm handling now, the option is used. The customer complains about RST as response to FIN from its side on connection close ...
dimba's user avatar
  • 27.2k
121 votes
9 answers
222k views

How to convert from []byte to int in Go Programming

I need to create a client-server example over TCP. In the client side I read 2 numbers and I send them to the server. The problem I faced is that I can't convert from []byte to int, because the ...
Emanuel's user avatar
  • 6,792
120 votes
8 answers
221k views

Does a TCP socket connection have a "keep alive"?

I have heard of HTTP keep-alive but for now I want to open a socket connection with a remote server. Now will this socket connection remain open forever or is there a timeout limit associated with it ...
Kevin Boyd's user avatar
  • 12.3k
113 votes
5 answers
77k views

WebSockets ping/pong, why not TCP keepalive?

WebSockets have the option of sending pings to the other end, where the other end is supposed to respond with a pong. Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in response, ...
Thomas's user avatar
  • 178k
111 votes
13 answers
181k views

TCP vs UDP on video stream

I just came home from my exam in network-programming, and one of the question they asked us was "If you are going to stream video, would you use TCP or UDP? Give an explanation for both stored video ...
Alxandr's user avatar
  • 12.4k
111 votes
16 answers
101k views

Do I need to heartbeat to keep a TCP connection open?

I have two components that that communicate via TCP/IP. Component A acts as a server/listener and Component B is the client. The two should communicate as quickly as possible. There can only ever ...
Rob Gray's user avatar
  • 3,226
110 votes
1 answer
60k views

Why is network-byte-order defined to be big-endian? [closed]

As written in the heading, my question is, why does TCP/IP use big endian encoding when transmitting data and not the alternative little-endian scheme?
Neji's user avatar
  • 6,691
106 votes
1 answer
65k views

Does WebRTC use TCP or UDP?

I have some questions about WebRTC: Does WebRTC use TCP or UDP as its peer-to-peer transport? How can I know? I read that there are reliability mode and DTLS agreement, how does these affect? Is this ...
onmyway133's user avatar
  • 46.9k
105 votes
15 answers
78k views

What do you use when you need reliable UDP?

If you have a situation where a TCP connection is potentially too slow and a UDP 'connection' is potentially too unreliable what do you use? There are various standard reliable UDP protocols out there,...
Len Holgate's user avatar
  • 21.4k
102 votes
4 answers
242k views

Can I use tcpdump to get HTTP requests, response header and response body?

I am using tcpdump to get HTTP data by executing the below command: sudo tcpdump -A -s 1492 dst port 80 The result of above command: Headers, I think request and response headers. ...
kimo's user avatar
  • 1,884
102 votes
10 answers
195k views

Detecting TCP Client Disconnect

Let's say I'm running a simple server and have accept()ed a connection from a client. What is the best way to tell when the client has disconnected? Normally, a client is supposed to send a close ...
Zxaos's user avatar
  • 7,941
100 votes
4 answers
162k views

What is SOCK_DGRAM and SOCK_STREAM?

I just came across this strange thing I got to see application is that by default they use SOCK_STREAM function. Why is it so? Is this SOCK_STREAM just creating multiple streams? Or is it the ...
echo9's user avatar
  • 1,219
97 votes
4 answers
123k views

Simple Socket Server in Bash?

Is there a way to quickly bind to a TCP port/ip address and simply print out all information to STDOUT? I have a simple debugging solution which writes things to 127.0.0.1:4444 and I'd like to be able ...
Naftuli Kay's user avatar
  • 89.4k

1
2 3 4 5
476