How to make an Echo server with Bash?

If you use ncat instead of nc your command line works fine with multiple connections but (as you pointed out) without -p. ncat -l 2000 -k -c ‘xargs -n1 echo’ ncat is available at http://nmap.org/ncat/. P.S. with the original the Hobbit’s netcat (nc) the -c flag is not supported. Update: -k (–keep-open) is now required … Read more

TCP Vs. Http Benchmark

HTTP is a layer built ontop of the TCP layer to some what standardize data transmission. So naturally using TCP sockets will be less heavy than using HTTP. If performance is the only thing you care about then plain TCP is the best solution for you. You may want to consider HTTP because of its … Read more

What is “backlog” in TCP connections?

NOTE : Answers are framed without having any background in Python, but, the questions are irrelevant to language, to be answered. What are these queued connections? In simple words, the backlog parameter specifies the number of pending connections the queue will hold. When multiple clients connect to the server, the server then holds the incoming … Read more

Nodejs random free tcp ports

You can bind to a random, free port assigned by the OS by specifying 0 for the port. This way you are not subject to race conditions (e.g. checking for an open port and some process binding to it before you get a chance to bind to it). Then you can get the assigned port … Read more

What are the retransmission rules for TCP?

What exactly are the rules for requesting retransmission of lost data? The receiver does not request the retransmission. The sender waits for an ACK for the byte-range sent to the client and when not received, resends the packets, after a particular interval. This is ARQ (Automatic Repeat reQuest). There are several ways in which this … Read more

How to find the largest UDP packet I can send without fragmenting?

The following doesn’t answer your question directly but you might find it interesting; it says that IP packets can be disassembled/reassembled, and therefore bigger than limit on the underling media (e.g. 1500-byte Ethernet): Resolve IP Fragmentation, MTU, MSS, and PMTUD Issues with GRE and IPSEC More on this topic: Re: UDP fragmentation says you should … Read more

Why is bind() used in TCP? Why is it used only on server side and not in client side?

It assigns the “local” end’s port number. For a server socket, this is the ultimate way to go – it is exactly what is needed: have your socket be bound to port 80 for a web server, for example. For a client socket, however, the local address and port is normally not of importance. So … Read more

Does TCP send a SYN/ACK on every packet or only on the first connection?

It’s kinda like: +——————————————————-+ | client network server | +—————–+ +——————–| | (connect) | —- SYN —-> | | | | <– SYN,ACK — | (accepted) | | (connected) | —- ACK —-> | | \_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/ when client sends… \_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/ | | | | | (send) | —- data —> | | | | <—- … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)