sockets

Writing Async(Or async like) Client Socket Code in Java

I am writing a socket client for interacting with a network service. Currently because I want to support async reading and writing I am threading both the output stream and the input stream of one socket, but I was wondering if there is a better way to do this. I have taken a look at Java NIO and was not very impressed, and I also looked...

asynchronous client socket closing ??

hey i want to ask a question about asynchronous socket communication on c#. everything is working well for now apart from closing clients. server doesnot close immediately the worker socket for client when a client close its conneciton. it closes a few time later. how can i resolve this problem?? ...

WCF Socket Problem

I am using a WCF application which is hosted as a Windows service. This application is accessing an email account and downloading mails that have a CSV attached to it. But sometimes I am getting this exception: 10/1/2010 10:39:52 AM - 2 - System.Net.Sockets.SocketException: An established connection was aborted by the software in your...

Sample Code for Asynch Sockets Server and Client in VB.net

HI there, could someone point me in the direction of a good case study with source code of asynchronous socket programming in VB.NET preferably VS2005 .net 3.5 vintage. ...

Socket.SendAsync taking several seconds to complete.

I'm trying to optimize a tcp socket wrapper which is struggling with lots of inbound connections. I'm testing it within a basic chat server and a small client app to send clients to it. Both apps are on a separate W2k3 server connected by a gigabit switch. By trial and error I've refined my testing to 10 clients connecting at 100ms in...

How does the HTTP protocol work exactly?

I thought I had this all figured out, but now that I'm writing a webserver, something is not quite working right. The app listens on a port for incoming requests, and when it receives one, it reads everything up to the sequence "\r\n\r\n". (Because that signifies the end of the headers - yes, I am ignoring possible POST data.) Now, aft...

What's the best way to handle multiple outgoing connections in Perl?

I have three TCP servers I need to connect to, each with different protocols, but all in nonblocking mode. Right now my plan is essentially opening a new IO::Socket per each one and adding them to IO::Select, then looping through can_read(). The idea is based on how servers are usually written in Perl, but it seems like it could work for...

Issues with implementing a network server with SocketServer

Dear Friends! I am beginner in socket programming and need your help. I have implemented simple echo server using ThreadedTCPServer example from the Python documentation. It works fine, but I have the following problems: 1) Server hangs (in socket.recv) when Client tries to send zero-length data. 2) Server hangs (in socket.recv) when th...

Java: Get Notified On Incoming Packet

Hello, I'm working on a library that is currently using standard tcp sockets. An end user of my library registers themselves as a listener, and needs to be notified if/when a relevant message comes in. If I spawn a worker thread within my library, there is a thread-death problem where my library may prevent the application from termin...

What prior knowledge do i need to have for socket programming?

I have to design GUI for authentication. Which will have 1. User name 2. Password using The stream socket, The packet socket or The raw packet in php and mysql language. any references or tutorials? ...

java socket threads

hi. im trying to create a client server game using java sockets. i have a thread server which controls the logic of the game. i also have client threads that communicate with the server. i use multiple client handler threads to facilitate server to client communication. i use multiple threads to communicate with other client threads usin...

C# Socket Trick

I am sending and receiving bytes between a server and a client. The server regularly sends some message in the form of bytes and client receives them. Message format is below: {Key:Value,Key:Value,Key:Value} Now at the client side instead of receiving this message, I am receiving multiple copies of this message which is not suitable fo...

Java application wanting to use both Inet4Address and Inet6Address at the same time

I have a Java application that needs to connect via sockets to two different servers on two separate machines. One server has been configured to listen on IPv4 connections, while the other has been configured to listen on IPv6 connections. Now, assuming "host1" is the machine name of the server listening on IPv4 connections, while "hos...

Closing a listening TCP socket in C

Hi; Suppose you have a socket listening on a TCP port, and some clients are connected. When one issues sock_close(fd) in C and tries to bind again on the same port, binding fails. Some TIME_WAIT state is seen on the "netstat -plutnoa" such as: tcp 0 0 127.0.0.1:4567 127.0.0.1:32977 TIME_WAIT - ...

Choosing multicast network interface in Python.

I have a server with two separate Ethernet connections. When I bind a socket in python it defaults to one of the two networks. How do I pull a multicast stream from the second network in Python? I have tried calling bind using the server's IP address on the second network, but that hasn't worked. ...

Keeping a connection open for each client in php

I have a C++ backend application coded over a TCP socket, to which I connect PHP to. The problem is that the connection is closed on every refresh, change page, etc. I would like to keep the connection open for each client, doing something like $_Session does. ...

Problem with AsyncCallback in C# .NET 3.5

I have created a single threaded Windows application which communicates with more than 100 sockets (using AsyncCallbacks), may be 5-10 sockets in a sec. The application works fine when I launch from .NET IDE. The application seems to be hanged if launched from executable. On further research I found that application is communicating on ...

Non-blocking socket not observing OP_READ set - possible race condition?

So I've got a multithreaded server app using non-blocking sockets listening for connections. When a client connects, the client immediately sends a request and awaits a response. The server creates a new thread to handle the new connection, ensures that finishConnect is called and registers the new channel against the selector. Now, th...

Python SocketServer

Hi, How can I call shutdown() in a SocketServer after receiving a certain message "exit"? As I know, the call to serve_forever() will block the server. Thanks! ...

Working with binary data in PHP

I'm writing a client for a binary socket protocol in PHP, and it's a pain. I'm currently using pack to convert numbers into binary strings, but it's lacking. Two options pack has are: Write a signed 32 bit integer in machine byte order Write an insigned 32 bit integer in big endian byte order But I need to write signed 32 bit integer...