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.

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 on top of the underlying packet-oriented, unreliable IP layer. TCP is referred to as a connection-oriented protocol. This is opposed to UDP, which offers a relatively bare-bones unreliable all-or-nothing delivery of discrete packets and is referred to as a connection-less protocol.

How TCP fits into Internet protocol suite layers (going top to bottom):

  • Application: Encrypts data to be sent or sends data in a specific format (e.g. TLS or HTTPS)
  • Transport: Splits the data into segments and adds a TCP header to each (creating a TCP segment)
  • Internet: Encapsulates each segment (and splits if necessary) into IP packets (with source and destination IP address)
  • Link: Encapsulates each packet (and splits if necessary) and adds physical address (MAC)

The basic definition of TCP is given in RFC 793. There is more information at the Wikipedia article on TCP.

23633 questions
223
votes
14 answers

UDP vs TCP, how much faster is it?

For general protocol message exchange, which can tolerate some packet loss. How much more efficient is UDP over TCP?
Net Citizen
  • 5,174
  • 8
  • 38
  • 50
214
votes
2 answers

Differences between TCP sockets and web sockets, one more time

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 websockets and pure TCP How to establish a TCP Socket…
pierroz
  • 7,653
  • 9
  • 48
  • 60
214
votes
11 answers

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 transport-level protocol that is message-driven like…
dmeister
  • 34,704
  • 19
  • 73
  • 95
211
votes
4 answers

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 via websockets?
xap4o
  • 2,776
  • 2
  • 19
  • 13
206
votes
7 answers

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 connections, and we know that the number of ports…
K J
  • 4,505
  • 6
  • 27
  • 45
203
votes
11 answers

Freeing up a TCP/IP port?

netstat -tulnap shows me what ports are in use. How to free up a port in Linux?
bapi
201
votes
8 answers

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 instead I want to use NGINX to add an SSL layer to…
crockpotveggies
  • 12,682
  • 12
  • 70
  • 140
189
votes
6 answers

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 itself can contain colons. For example, this is…
Peter Wone
  • 17,965
  • 12
  • 82
  • 134
180
votes
5 answers

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

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 recognized in Command Prompt. Could anyone help me to fix this?
Nikesh Devaki
  • 2,091
  • 2
  • 16
  • 24
169
votes
2 answers

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); // v…
Robert
  • 37,670
  • 37
  • 171
  • 213
169
votes
7 answers

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 regardless of bandwidth? I'm assuming HTTP works…
David
  • 2,083
  • 3
  • 17
  • 14
167
votes
8 answers

Check status of one port on remote host

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 command against a host I know has that port open. …
Sheila
164
votes
11 answers

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 end is sending a packet with the reset (RST) flag…
Luke
  • 18,585
  • 24
  • 87
  • 110
158
votes
13 answers

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 know that TCP is used for HTTP, HTTPs, FTP, SMTP,…
user749414
  • 1,597
  • 2
  • 10
  • 4
158
votes
5 answers

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 written in user layer, server written in C++…
Rohit
  • 6,941
  • 17
  • 58
  • 102