tcp

.NET TCP server stability issues

Hi, I have build a basic .NET server-client infrastructure using TcpListener and SocketClient. It is multithreaded and asynchronious. The problem is, that the server crashes at some point when over 30 clients are connected at once. I could not yet locate the cause for the crashes though I do use quite a few Try-Catch blocks to make su...

How can I connect to a TCP server using Silverlight?

I'm learning silverlight programming as well as networking and I was using this tutorial: http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server However in it it says to connect to a server you must create an instance of TcpClient, in my server side code which uses the forms application I have access to TcpC...

How to detect which TCP packets are part of a HTTP connection in C#?

I am working on url tracker project where I have to track all sites visited by a user. So I decided to do it by tracking TCP packets on every user request. So I am capturing all the TCP packets user requesting. But how can I figure out if it is a normal TCP request or HTTP request. Any suggestion will be very helpful. Thanks. ...

Using pexpect to listen on a port from a virtualbox

Hi all, I am trying to create a tcplistener in python (using pexpect if necessary) to listen for tcp connection from Ubuntu in virtualbox on a windows xp host. I would really appreciate it, if one of you could point me in the right direction. Thank you. P.S: I have limited experience in the area, any help would be welcome. ...

sending images over stream socket

Hi, Could anyone direct me as to whether there is a special way of sending images (specifically .jpeg files) across a tcp socket? So far I am developing a webserver that seems to send all the text data well. When it comes to jpeg images, the headers are sent however, the Cygwin console just freezes when it comes to sending the actual da...

How to find programmatically out S/N ratio of a network?

Hi, I have a MANET and am writing an application which will be running on the base station and plugged into the TCP network. I wanted to know how can I figure out the signal-to-noise ratio of a selected node in the MANET? The GUI is based on Qt and I am also using BOOST which I don't have much experience with. I don't know where to st...

Binding multiple times to the same port

Hi, is there a way to bind multiple listening TCP sockets on the same {IP, port}? I know I can just open a socket, bind, fork and then listen in each of the processes. But I'd like to do the same with separate processes that cannot fork after binding. Is there some way to allow this and not get the "Address already in use" error? The on...

C# read binary data from socket

Hello, I'm working on an application that reads and writes binary data from and to a socket. So first I create a socket with TcpClient. But I'm stuck on reading the data from the socket. Are there any code samples on how to read binary data from the socket? Concrete, there are 2 things I don't understand. First, how do I know if a mess...

Receiving complete message from TCP socket

Hi, I read data from a TCP socket connection, but the server sends me \0 from time to time (which would mark the end of a message). Thus, I do not get the rest of the message. I read like this: uint8_t buf[tcpBufferSize]; unsigned int len = 0; len = [inputStream read:buf maxLength:tcpBufferSize]; if(len > 0) { NSMutableData* dat...

C# byte streams through TCP

I'm a Jr. Engineer hoping to seek some advice from all of the experienced people in here in regards to how to approach this. I've been assigned a project to create a server/client application that does byte streaming through TCP. Our company deals with 2-way radios with GPS with a dispatch software and we would like to make a server/cl...

TCP Socket Connection Server Side Type

Hi, I'm working on a small flash project for a web site. I've coded my tcp-server on a windows service. Is it possible to put the tcp-server on a web service ? Or should I accept the tcp-connections while the web page is loaded? Any suggestions? Really I do not know the way to put the server. [With windows service it works, but I have...

How does serversocket class serve multiple client connections on same port?

Hi, When using a Socket class one is establishing a TCP connection to a server on some port, but on the server the ServerSocket is capable of handling multiple client connections for each accept request and delegate it to a thread to server the request. But how is it possible for a ServerSocket class to accept multiple tcp connections on...

TCP server: how to avoid message overlapping

I am going to write a TCP server, the client sends me XML message, I am wondering if below condition will happen and how to avoid that: 1) client sends <cmd ...></cmd> 2) sever is busy doing something 3) clients sends <cmd ...></cmd> 4) server does a recv() and put the string to buffer Will the buffer be filled with <cmd ...></cmd><cmd...

TCP handshake phases corresponding to select() and accept() return points

I have a TCP server that creates a (blocking) socket, waits until it is available for reading using select(), then calls accept() and starts reading the data. Here is an example (not mine) illustrating the concept. The question is, at what points of TCP handshake does select() and accept() calls return? Ubuntu Hardy, if it matters. 2...

TCP packet splitting in node.js

I'm implementing a server in node.js for a protocol that has unterminated packets. i.e: _________________________________________________________________________ | packet type | string length 1 | string 1 | string length 2 | string 2 | So I don't know the length of the packet until it has been fully parsed. This causes problems, becau...

How do web servers avoid TIME_WAIT?

I'm writing a simple HTTP server and learning about TIME_WAIT. How do real web servers in heavy environments handle requests from thousands of users without all the sockets getting stuck in TIME_WAIT after a request is handled? (Not asking about keep-alive -- that would help for a single client, but not for thousands of different clien...

Using iPhone as a TCP and UDP server - open ports?

Hey, I need to send and get packeges via UDP and TCP in iPhones and the server. But, I figured that if I wanna send pacgages to a client (iPhone), he is... A kinda server. So, let's say I'm sending and getting packeges to iPhone via the port 2347. Do I need to open the port on the iPhone or something like that? Is there any Firewall buil...

TCP protocol : Host goes temporarily unavailable

Say our client is sending the packets at a constant rate. Now, if server goes down temporarily there can be two situations (We are using the TCP protocol) 1) The packet won't be delivered to the server. Consequently, the other packets in the line have to wait for the server to respond. And the communication can be carried out from ther...

Keep TCP connection persistent even after sub-routine calling connect() is end. How?

I have an application that calls connect() in a subroutine A. This sub-routine A is called when a button A is pressed. After connection has established, user can choose to click button B. This button B has to be programmed as a separate sub-routine. However, I need TCP connection to run sub-routine B. After connect() is called in s...

Stopping an asynchronous TCP server on separate thread in C#

I have implemented an asynchronous TCP server that is spawned by another process. It starts fine and operates as expected, however I am having trouble terminating the server when I end the process that started it. The following is my current TCP server and stopping function from the other process. TCP Server public class StateObj...