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
5
votes
1 answer

Golang TCP Connection Slow when Server Doesn't Have Backlog Available

Update With the added pthreaded C client, the problem is recreated, indicating the long connection times are part of the TCP protocol, rather than specific implementations. Altering those protocols doesn't seem easily available. Initial Question I…
bbg
  • 51
  • 5
5
votes
4 answers

How do you get the ephemeral port number of a client in ASP .NET?

I would like to track client sessions by connection (not session state or cookies) in ASP .NET. I was planning on doing this by using the client's IP address and ephemeral port number. You can get the IPAddress in ASP .NET…
Brandon Cuff
  • 1,438
  • 9
  • 24
5
votes
0 answers

Clickhouse distributed table node stops accepting TCP connections

Clickhouse version: (version 20.3.9.70 (official build)) (I know this is no longer supported, we have plans to upgrade but it takes time) The Setup We are running three query nodes (nodes with distributed tables only), we spun up the third one…
user358656
  • 101
  • 1
  • 5
5
votes
2 answers

writing over a disconnected socket does not throw

the writer: socket.setSendBufferSize(1); socket.setTcpNoDelay(true); writer = new BufferedWriter( new OutputStreamWriter(socket.getOutputStream(), "UTF-8")); is used as follows: try { writer.write(packet.toXML()); …
kellogs
  • 2,837
  • 3
  • 38
  • 51
5
votes
3 answers

socket.emit in a simple TCP Server written in NodeJS?

[as you'll see, I don't understand the basic concepts of a TCP server and client very well and probably socket.emit is not even possible, but I'd like to know the best alternative or similar thing...] Socket.io has a beautiful thing to emit events…
João Pinto Jerónimo
  • 9,586
  • 15
  • 62
  • 86
5
votes
5 answers

How to push (i.e. flush) data sent to a TCP stream

RFC 793 says that TCP defines a "push" function that ensures that the receiver got the data: Sometimes users need to be sure that all the data they have submitted to the TCP has been transmitted. For this purpose a push function is defined. …
Joey Adams
  • 41,996
  • 18
  • 86
  • 115
5
votes
1 answer

CocoaAsyncSocket and reading data from a socket

On my TCP-socket based server, I send a packets over the stream where packets consist of a header specifying the number of bytes in the packet, followed by that number of bytes. For those familiar with Erlang, I'm simply setting the {packet, 4}…
randombits
  • 47,058
  • 76
  • 251
  • 433
5
votes
2 answers

What happened to the TCP Nagle flush?

According to this Socket FAQ article, Nagle's algorithm is one of many algorithms that can cause a bunch of data to sit in the TCP buffer and not hit the wire. The delay from the Nagle algorithm can be up to 200ms. For some reason, Nagle's algorithm…
Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
5
votes
7 answers

How do I send an array of integers over TCP in C?

I'm lead to believe that write() can only send data buffers of byte (i.e. signed char), so how do I send an array of long integers using the C write() function in the sys/socket.h library? Obviously I can't just cast or convert long to char, as any…
Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
5
votes
0 answers

How can we allow TCP/IP connections for SQL Server on Docker?

I'm learning Java EE, and I'm trying to open a connection to my SQL Server database running on a Docker image. I obviously get the Cannot create PoolableConnectionFactory (The TCP/IP connection to the host localhost/DB_DEMO, port 1433 has…
JoRiviera
  • 51
  • 1
  • 4
5
votes
1 answer

Linux TCP Connection timeout

I observe the TCP timeout from server to client. When TCP Three-way Handshake finished, and then the client does not anything for a long time. How many times will timeout TCP sessions? I consult the RFC 793 document, 3.8 Interfaces: The timeout,…
Rain
  • 105
  • 1
  • 2
  • 7
5
votes
2 answers

Exceptions when reading protobuf messages in Java

I am using protobuf now for some weeks, but I still keep getting exceptions when parsing protobuf messages in Java. I use C++ to create my protobuf messages and send them with boost sockets to a server socket where the Java client ist listening. The…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
5
votes
2 answers

How to Find TCP Retransmissions while sniffing packets in C

I've written a simple source file that can read pcap files using the libpcap library in C. I can parse the packets one by one and analyze them up to a point. I want to be able to deduce whether a TCP packet I parsed is a TCP retransmission or not.…
5
votes
1 answer

Python3 NAT hole punching

I know this topic is not new. There is various information out there although, the robust solution is not presented (at least I did not found). I have a P2P daemon written in python3 and the last element on the pie is to connect two clients behind…
pr0logas
  • 523
  • 1
  • 5
  • 14
5
votes
1 answer

Find answer to tcp packet in PCAP with scapy

I parse pcap file with scapy python , and there is TCP packet in that pcap that I want to know what is the answer of this pcaket, How can I do that? For example : client and server TCP stream client-> server : "hi" server-> client : "how are…
paramikoooo
  • 177
  • 2
  • 16
1 2 3
99
100