tcp

Building Multi threaded TCP/IP Server

I wanna build a TCP/IP server that will be used by up to 100 concurrent clients, but still not sure how to get started. at least I need the server to this: Listening to client, and store all them on array or list. for each client, it need to receive and send data based on it's client status. The server should update the clients list w...

Unix TCP servers and UDP Servers

Why is the design of TCP servers mostly such that whenever it accepts a connection, a new process is invoked to handle it . But, why in the case of UDP servers, mostly there is only a single process that handles all client requests ? ...

How can I diagnose "Cannot determine peer address" in my Perl TCP script?

I've this little script which does it's job pretty well but sometimes it tends to fail. It fails in 2 cases: with error send: Cannot determine peer address at ./tcp-new.pl line 52 with no output or anything, it just fails to deliver what it got to connected Tcp Client. Usually it happens after I disconnect from server, go home and con...

How can I slow down a TCP connection on Windows?

I am developing a Windows proxy program where two TCP sockets, connected through different adapters are bridged by my program. That is, my program reads from one socket and writes to the other, and vice versa. Each socket is handled by its own thread. When one socket reads data it is queued for the other socket to write it. The probl...

How to get the original TCP connection hostname in Python Twisted?

With Twisted's TCP mechanisms, when a protocol is created, the only information about the peer is its IP address and port. How can I retrieve the original hostname that I tried to connect with? reactor.connectTCP('somehost.com', 80, MyFactory) How can I ever get 'somehost.com' through a callback somehow? In other words, connectTCP ret...

Any program that calculates the throughput from the output of tcpdump?

I am currently using tcptrace but am observing some ridiculous throughputs on a test that I'm running. I am pretty sure something is wrong with the way I am testing but before spending any more time is there any other program I can use to verify this? EDIT: This is for a router simulator that I am running locally on my system that gene...

TCP server causes MAX CPU utlization.

hi. i write this TCP communication library. the problem is that. when a client connects. the CPU usages boosts to maximum....this causes other application to become slow... please take a look at the code and correct me where i did wrong.. the main code of my TCP library is TCP Server Class public class TCPServerEndPoint : ICommunic...

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 local IP to one port on one remote IP. The tuple (local ip, local port, remote ip, remote port) is what uniquely defines a TCP connection; d...

determine if TCP connection uses SSL

Perhaps some server can handle both non-secure and secure protocols. Is there known way to determine if existing TCP connection secure or not? (I believe it is possible just monitor traffic and check if some text is readable, but maybe there is better or maybe more detailed suggestions?) ...

C# TCP Socket Port Proxy Translation Forwarding?

I've been experimenting with many TCP Socket projects found on the Internet. The 'Server' class will often accept 'multiple clients', but only one connection at a time due to 'Single Port' usage restrictions. I've discovered Winsock responds differently on Visa than XP. The Visa Winsock will redirect the same incoming port to a random, u...

Need some help interpreting tcpdump output...

I've checked the tcpdump man page and thought I understood the example provided there. But the one that I am getting is something I'm not able to understand completely. ORIGINAL: Simulator Output LINE 1: 20:01:13.442111 IP 10.0.0.1.12345 > 10.0.0.2.54321: S 1234:1234(0) win 65535 LINE 2: 20:01:13.471705 IP 10.0.0.2.54321 > 10.0.0.1.123...

how to know which is the last TCP segment received by the server when data is transferring?

When transferring data in TCP, and given all the incoming and outcoming packets, how will one know if the packet received is the last of the data? TCP packets are fragmented into smaller parts. I'm transferring over the HTTP protocol. ...

How can I benchmark TCP and UDP using C?

I want to measure message latency and throughput for both TCP and UDP using C sockets. I am writing a client.c and server.c (Question 1: Do I have to?) that run on different servers to accomplish this. I have to take several measurements using different packet sizes and multiple trials and plot my results. For message latency: Send a pa...

length of captured packets more than MTU

Hi, I m running iperf between two machines (linux) and I can observe the mtu of both the interfaces connected is 1500. I ran tcpdump to capture packets and I observed some packets have "length as 2962"....how come this is possible with mtu as only 1500? Please clarify. Thanks! Note: flags field is set as DF. and proto is TCP ...

Why does a SYN or FIN bit in a TCP segment consume a byte in the sequence number space?

I am trying to understand the rationale behind such a design. I skimmed through a few RFCs but did not find anything obvious. ...

Tcp Reliability versus Udp Burdens for serious, high-performance server

Speed, optimization, and scalability are the typical comparisons between the Udp and Tcp protocols. Tcp touts reliability with the disadvantage of a little extra overhead, but speed is good to excellent. Once a Tcp socket is instanced, keeping the socket open requires some overhead. But compared to the oft described burdens of Udp, which...

how to know if a packet sniffed is accessed from a website directly and not linked?

is there any way to know if a certain tcp segment which has a request message to a server is directly accessed by a user through a browser. not just that its linked by the browser itself to complete the requested page. like for example, a web page with images, when one browses this page, the sniffer tends to get all this urls including ...

Rationale behind ACKs and SEQs?

I am not sure if people find this obvious but I have two questions: During the 3-way handshake, why is ACK = SEQ + 1 i.e. why am I ACKing for the next byte that I am expecting from the sender? After the handshake, my ACK = SEQ + len. Why is this different from the handshake? Why not just ACK for the next byte I am expecting as well (th...

Which Audio Codec should I use?

Which audio codec should I choose for my C# software development project where the raw audio to be transcoded/transported/used is based on the following: For encoding Speech only Audio can be stereo or mono Able to support live streaming Good tradeoff between file size and quality To be transported over TCP/IP in its encoded form Can b...

Create multiple TCP Connections in C# then wait for data

Hi Everyone, I am currently creating a Windows Service that will create TCP connections to multiple machines (same socket on all machines) and then listen for 'events' from those machines. I am attempting to write the code to create a connection and then spawn a thread that listens to the connection waiting for packets from the machine,...