tcp

To send an image every 50 ms., should I use TCP or UDP?

I am building a C# application, using the server-client model, where the server is sending an image (100kb) to the client through a socket every 50ms... I was using TCP, but besides the overhead of this protocol, sometimes the client ended up with more than one image on the socket. And I still haven't though of a clever mechanism to sp...

When will a TCP network packet be fragmented at the application layer?

When will a TCP packet be fragmented at the application layer? When a TCP packet is sent from an application, will the recipient at the application layer ever receive the packet in two or more packets? If so, what conditions cause the packet to be divided. It seems like a packet won't be fragmented until it reaches the Ethernet (at th...

When I send a packet over tcp, it is split into two packets

Hello guys, I am developing an application in C#, using the server-client model, where the server sends a byte array with a bitmap to the client, the client loads it into the screen, sends an "OK" to the server, and the server sends another image, and so on. The length of the image buffer deppends, usually it is between 60kb and 90kb, ...

Monitoring a tcp port

For fun, I've been toying around with writing a load balancer in python and have been trying to figure the best (correct?) way to test if a port is available and the remote host is still there. I'm finding that, once connected, it becomes difficult to tell when the remote host goes down. I've turned keep alive on, but can't get it to r...

.NET project for TCP messaging

Is there an open source project or framework in .NET which provides the basic "plumbing" for messaging between client(s) and server over TCP? It seems like one of those things where I end up writing essentially the same thing over and over, and I'd like to abstract myself away from that a little bit more and deal with the particulars of ...

How can I simulate a socket disconnection (on windows) between a client and a server?

I've implemented a kind of 'heartbeat solution' and I'd like to see what happen when the network 'goes down', in real conditions, specially if it happens when there is no traffic on the socket. Problems: - I've got only one computer; - I'm on windows/java; I guess that simply unplugging the network cable/deactivating the network card ...

How to read to inputstream in tcp socket communication for multiple formats in java

Hi, In TCP based communication, I need to, listen/read to, multiple formats on DataInputStream. Such as write and writeUTF. I need to identify the mode used by other end to switch to that mode such as when writeUTF(String) is used I need to use readUTF(), and if the write(byte[]) is used then I should be able to switch to read() ...

How to use markSupported feature of inputstream java

I intend to use the markSupported feature for checking first byte to check the format then reset it, please tell me which stream should be used for tcp based communication in java. For most of the streams like datainputstream does not provide this feature. Please can give me some pointers to use mark and reset. ...

C#: Simple TCP server question

Hello, I tried to send a packet on the socket I use to listen for connections - i failed of course. I remember the days I coded in pascal that there was another socket I should send connections too,it was received after "Accept". Well,if this is correct then this is my problem: I'm using WSAAsyncSelect() in my TCP server(C#) protect...

Asynchronous Server-Side TCP/IP

Hello, I saw just what I needed at msdn to create my TCP server,but there are missing parts in the code. >Here's< the article and here's the code: // This server waits for a connection and then uses asynchronous operations to // accept the connection with initial data sent from the client. // Establish the local endpoint for the sock...

C#: Crash on ManualResetEvent

Hello, I wrote my code using this article at msdn as a primary helper My code: private ManualResetEvent _AllDone = new ManualResetEvent(false); internal void Initialize(int port,string IP) { IPEndPoint _Point = new IPEndPoint(IPAddress.Parse(IP), port); Socket _Accpt = new Socket(AddressFamily.InterNetwork...

Too many TIME_WAIT connections

We have a fairly busy website (1 million page views/day) using Apache mod proxy that keeps getting overloaded with connections (>1,000) in the TIME_WAIT state. The connections are to port 3306 (mysql), but mysql only shows a few connections (show process list) and is performing fine. We have tried changing a bunch of things (keep alive o...

Reverse Ajax without Comet?

Is it possible to let the web server send a message to the web browser without Comet? Every major web company like Facebook and Google uses Comet for this purpose and it just seems like an ugly hack waiting to disappear if tcp connections were enabled for major browsers. ...

sever/kill tcp connection in windows

I would like to see how a program responds when it's connection is severed. Aside from disabling the network card, is there a way to sever a tcp connection in Windows without killing the process, or the thread that owns the connections? ...

Existing connection close when new TCP connections are made

I have a TCP listener service to which the clients connect. Lately I have started receiving this error related to disconnection. I connect around 20 clients to it and the connection works fine. But when I connect another 10 clients to the service, the previous connections break with a 10053 or 10054 error. Previously it used to run with...

Most efficient way to read in a tcp stream in Java

I'm having to modify some client side code because the comms protocol wasn't defined properly. I'd assummed that a tcp message from the server would terminate in a new line so I used reader.readLine() to read my Data. Now I've been told that this is not the case and that instead the first 4 chars of the message are the message length a...

Connection refused after some time on threaded process in tcp socket requests (c/linux)

I'm trying to make process that takes number of requests each second, on each request new thread is created. Each thread then opens socket connection to address (http port) sends HEAD requests, gets response and closes socket. Problem I'm having comes when i put more then 3 requests per second, after some time i get error in send() part...

How can I get the interface name/index associated with a TCP socket?

Hi, I'm writing a TCP server that needs to know which interface each connection arrived from. I cannot use the address/subnet to deduce which interface was used, since there might be interfaces with the same address/subnet values. It's Linux based, and there's no need for the code to be portable. All I could find were functions to get ...

Application level checksumming as the tcp checksumming might be too weak?

This Paper (When the CRC and TCP checksum disagree) suggests that since the TCP checksumming algorithm is rather weak, there would occur an undetected error every 16 million to 10 billion packets using TCP. Are there any application developers out there who protect the data against such kind of errors by adding checksums at the applicat...

MSMQ works on TCP or UDP?

hi. i want to know that MSMQ (Microsoft Messaging Queue) works on TCP or UDP?? and on what ports? ...