tcp

problem by connecting a device [modem] over TCP

Hi to all, I want to connect a device [a kind of modem] over TCP-Protocol. The device could be considered as a client. Over a program I want to connect to this device. The program is located on a server and has a special port open and a static ip. How can I do it? Here is my code : // where ip= 10.0.0.50 and port= 5050, estab...

Blocking TCP socket write then immediatelly close - is it a problem?

I have a sender that TCP-connects, sends block of data, and closes the socket. I'd like to write the simplest, but reliable program that does the above. The first thing comes into mind (e.g. in .NET, although the question relevant to sockets in general): // assuming LingerOption(false), NoDelay set to whatever var client = new TcpClient...

mobile to mobile TCP socket connection

Reading among the list of possibilities of the Java ME platform, its possible for a J2ME app running on a mobile to initiate a TCP Socket or HTTP connection with a server. On similar lines, Is it possible to form a TCP socket connection between two mobile phones? ...

Reading from TCPSocket is slow in Ruby / Rails

I have this simple piece of code that writes to a socket, then reads the response from the server. The server is very fast (responds within 5ms every time). However, while writing to the socket is quick -- reading the response from the socket is always MUCH slower. Any clues? module UriTester module UriInfo class << self ...

Best practice to detect a client disconnection in .NET ?

I'm developing a server in C# which can accept only one client and I need to know when this client is disconnected to be able to accept another connection requests. I'm using a first Socket which continuously listen to connection request with Socket.BeginAccept and accept or reject clients. When a client is accepted, the new Socket whic...

Strange behaviour of networkstream.read() in C#

When i write to a network stream two seperate byte array, i sometimes dont get the first byte array. Why is that? For eg This fails, the header is not received, sometimes by Read() on other side byte[] header = msg.getByteHeader(); byte[] data = msg.getByteData(); clientStream.Write(header, 0,...

Disabling NICs or blocking all tcp connections

I was wondering if it's possible to use .NET to disable a certain network interface or, in alternative, to drop all the existing TCP connections (from the whole system) and then inhibit further creation. I'm asking this because I want to write a small C# utility that monitors the system and blocks networking (or at least TCP connections...

Are there any protocols/standards on top of TCP optimized for high throughput and low latency?

Are there any protocols/standards that work over TCP that are optimized for high throughput and low latency? The only one I can think of is FAST. At the moment I have devised just a simple text-based protocol delimited by special characters. I'd like to adopt a protocol which is designed for fast transfer and supports perhaps compress...

Which format for transmitting data over TCP?

Hi, I'd like some advice on which format to use for transmitting data over TCP. Currently, I have devised a simple text-protocol with delimited strings. I'm thinking I should use something out there that already exists such as XML, JSON, or XMPP? What data formats do people use for transmitting over TCP? I would like to optimize for...

TCP flow extraction

Hello My Friends, I need to extract TCP Flows with their content from dump file and then save their flow into other file each flow separately, does any one know a tool for processing this? I really appreciate for any Help Hanieh Rajabi. ...

Handling Partial return from recv() TCP in C

I've been reading through beejs guide to networking to get a handle on TCP connections. In one of the samples the Client code for a simple TCP stream client looks like: if ((numbytes = recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) { perror("recv"); exit(1); } buf[numbytes] = '\0'; printf("client: received '%s'\n",buf); cl...

How do I check if a Socket is currently connected in Java?

Hi, I'm trying to find out whether a Java TCP Socket is currently connected, the following just seems to tell me whether the socket has been connected at some point - not whether it is currently still connected. socket.isConnected(); Any help appreciated, thanks. ...

Linux TCP/IP Non-blocking send for socket stream..what happens to the TCP recv buffer?

This pertains to Linux kernel 2.6 TCP sockets. I am sending a large amount of data, say 300 MB, with a non-blocking send to another client who receives 8 MB at a time. After one 8 MB receive, the "receiver" stops receiving because it wants to perform other tasks, such as error handling. The sender would get a EWOULDBLOCK, but since ...

Multiple complete HTTP requests stuck in TCP CLOSE_WAIT state

I have a Java and Tomcat-based server application which initiates many outbound HTTP requests to other web sites. We use Jakarta's HTTP Core/Client libraries, very latest versions. The server locks up at some point since all its worker threads are stuck trying to close completed HTTP connections. Using 'lsof' reveals a bunch of sockets ...

Really weird HTTP client using TcpClient in C#

I am implementing a really simple HTTP Client that just connects to a web server and gets it's default homepage. Here it is and it works nice: using System; using System.Net.Sockets; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { TcpClient tc = new TcpClient(); ...

Maximum number of TCP connections on Windows Server 2003

Are there any statistics on the maximum number of open TCP connections that a Windows Server 2003 machine with a specific configuration can have at any given time? ...

Observer in a distributed environment

Machine A needs to send a message to machine B. Machine A has a static IP but machine B does not. One option I could think of to solve this problem is that machine B opens a TCP connection to machine A and then machine A sends the data/message to machine B. However, this solution has the following limitations: a) It is not scalable if ...

how to deal with a Server close TCP.

Right now I've got a simple TCP server/client. I have it set up so that whenever a client connects it gets forked() and the connection itself is put into an infinite loop so that the connection stays open. The server is receiving information from the client, I have a check to make sure that the number of bytes received is > 0. That has b...

Howto determine if connection is still alive with Indy?

I use Indy for TCP communication (D2009, Indy 10). After evaluating a client request, I want to send the answer to the client. I therefore store the TIdContext, like this (pseudocode) procedure ConnectionManager.OnIncomingRequest (Context : TIdContext); begin Task := TTask.Create; Task.Context := Context; ThreadPool.AddTask (Task...

Sending a string using TcpClient in vb.net

My tcp client has made a connection to the server script! Now that it has connected, how can it send a simple string? I do not know what any of the overloads for the .Client.Send method even mean, or how to use them. I already have a system set up on the server side to parse the string when it is received on the server side, but I have n...