sockets

C# Socket.BeginReceive/EndReceive

In what order is the Socket.BeginReceive/EndReceive functions called? For instance, I call BeginReceive twice, once to get the message length and the second time to get the message itself. Now the scenario is like that, for every message I send, I start waiting for its completion (actually acknowledgment of the message sent, also I wait...

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. ...

How to write a MultiPart download C++ program

I want to write a C++ program to download files with HTTP. For the sake of learning I would like to implement multipart downloading in my program the way DownThemAll! does. It is not possible to do lseek on a linux socket. I suppose it would be some HTTP option that we would need to specify, telling where to start downloading the file fr...

Error on server/client c program: "Connect: socket operation on non-socket"

I'm working on a socket program and everything seems fine.However after i compiled and run the server, i compile and run the client. But there is a problem in connect() function and even socket is ok client does not connect or server does not accept connection... While compiling, i got no errors. but after client has ran : error is ...

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 ...

C# Sockets Programming

Hey, I'm having nightmares with C# asynchronous socket programming. Can you point me to a guide or tutorial or a book which explains in depth asynchronous programming. If possibly contains how to use the state parameter in Begin Send/Receive functions to handle multiple clients. ...

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 ...

Socket.EndRead 0 bytes means disconnected?

I'm wondering if in my Async Sockets in c#, receiving 0 bytes in the EndRead call means the server has actually disconnected us? Many Examples I see suggest that this is the case, but I'm receiving disconnects a lot more frequent that I would be expecting. Is this code correct? Or does endResult <= 0 not really mean anything about the...

Socket throttling because client not reading data fast enough?

I have a client/server connection over a TCP socket, with the server writing to the client as fast as it can. Looking over my network activity, the production client receives data at around 2.5 Mb/s. A new lightweight client that I wrote to just read and benchmark the rate, has a rate of about 5.0Mb/s (Which is probably around the max ...

Actionscript 3: Socket not keeping up

I have a program made with flash/ac3 that connects with a java server. Using the following code: socket.addEventListener(ProgressEvent.SOCKET_DATA, onReceive); The socket receives messages just fine, however, when I start to send a lot of messages after each other things go wrong. Even when I only print the message I receive at least ...

Problem in Sending messages from Server to Client

Hi, im making a Window Application in C# using Socket Programming. I have developed a Server & a Client. Both are working fine but the problem which im gettin is that when ever i send any message from CLIENT, its send perfectly and receives on SERVER but whenever i try to send any message from SERVER it doesn't send to Client, since at t...

c++ vector<char> and sockets

Is there a way to call send / recv passing in a vector ? What would be a good practice to buffer socket data in c++ ? For ex: read until \r\n or until an upper_bound ( 4096 bytes ) ...

How can I list for each Windows TCP socket the status of SO_LINGER?

I want to verify that a group of sockets do (or do not) have the SO_LINGER option set on them, but the end I care about isn't my program. Basically, my program is getting an unexpected network reset (RST) and I believe it's because the server is setting SO_LINGER and the client isn't pulling the data fast enough. I can find plenty of w...

Socket Dis-Connects On One End, Firewall?

I have a C# application that has been running fine for several years. It connects via a TCP/IP socket to a machine that sends me stock trade executions. Recently, I've tried to deploy it to some machines in a new data center that is behind a hardware firewall, and I've started to see some weird dis-connects. When a dis-connect happen...

Socket programming

Hi everyone: Please take a look at my code: from twisted.internet.protocol import ServerFactory from twisted.internet import reactor from twisted.protocols import basic class ThasherProtocol(basic.LineReceiver): def lineReceived(self, line): print line self.transport.write( 1 ) self.transport.loseConnectio...

C# TCP Server Help

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.Net.Sockets; using System.IO; namespace PDMS_TCG { public partial class FormHost : Form { public FormHost()...

Mono Compatible Networking/Socket Library

Are there any Mono (C#) compatible networking / socket libraries out there? Preferably something that is: Multi Threaded Event Driven Capable of multiple connections Handles client and server pieces Runs on Mono and MS .NET runtimes Very simple Free (And usable in commercial software) It would also be really great if it was: .NET ...

Is there a way to reopen a socket ?

I create many "short-term" sockets in some code that look like that : nb=1000 for i in range(nb): sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sck.connect((adr, prt) sck.send('question %i'%i) sck.shutdown(SHUT_WR) answer=sck.recv(4096) print 'answer %i : %s' % (%i, answer) sck.close() This works ...

Java: ObjectOutputStream with Serializable problem

Hello, I have these three classes: Command: package pack; public abstract class Command impements java.io.Serializable { public abstract void execute(); } Client: package pack; // imports.... public class Client { Socket socket; // Constructor... public void sendCommand(Command c) { try { ...

Visual Studio 2008 Vista Socket Problem

Hey there, I am trying to use a port checking program written in Visual Studio 2008 using the 3.5 SP 1 .Net Framework, and I seem to have a problem using my program on Vista based OS's (in this case the actual OS is Windows 2008 Server (both 32 and 64 bit machines)) while it does however work fine on XP machines. I am not entirely sure w...