sockets

In case of a blocking recv call, if the peer side system reboots, the call doesn't come of out recv. Why?

When my code is in a blocking recv call, if the other side reboots, then this side recv call doesn't get to know about it and just goes into a hung state. How to avoid this? ...

C# Socket.Close - Should I still call Dispose?

Should I still call Dispose() on my socket after closing it? For example: mySocket.Shutdown(SocketShutdown.Both); mySocket.Close(); mySocket.Dispose(); // Redundant? I was wondering because the MSDN documentation says the following: Closes the Socket connection and releases all associated resources. Thanks. ...

Problem with Byte Flood Cryptography (C library)

I have a little problem with a C library: Byte Flood Cryptography. ( http://bfcrypt.sourceforge.net ). I would create a program which use both linux sockets and Byte Flood Cryptography (the Byte Flood Cryptography functions are near from those provided from stdio.h, and this, I have understand). I don't know how to 'bind' the two s...

Read system Call

Hi, I am trying my hands with unix socket programming in C. But while reading I am getting Err No as 4. I am unable to find out the description of this error code. Does anybody have any idea? ...

What are the units of UDP buffers, and where are docs for sysctl params?

I'm running x86_64 RedHat 5.3 (kernel 2.6.18) and looking specifically at net.core.rmem_max from sysctl -a in the context of trying to set UDP buffers. The receiver application misses packets sometimes, but I think the buffer is already plenty large, depending upon what it means: What are the units of this setting -- bits, bytes, packet...

determine socket connection state - android

I have an application that uses sockets to connect to my server. A lot of times the application lies "dormant" when it doesn't need to send info back and forth to the server. When that happens, occasionally it will disconnect. How can I determine when the socket has disconnected and then try to re-establish a connection? I've used so...

kCFStreamErrorDomainSSL error -9844

A customer of mine is reporting error "kCFStreamErrorDomainSSL error -9844" when trying to connect to a particular location using "stunnel" - is anyone familiar with this error or knows where I can find more information? Google turned up nothing. ...

Frustrating TCP Serialization Exception: Binary stream '0' does not contain a valid BinaryHeader

I posted a question on how to send large objects over TCP and it seems like the primary issue is solved, but now frequently I get another exception: Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization. The issue is sti...

How to Send a structure using sendto()

I have created structure : struct buffer { string ProjectName ; string ProjectID ; } buffer buf; buf.ProjectID = "212"; buf.ProjectName = "MyProj"; Now to send this structure using sendto method , I am typecasting the strucure and sending it back as below: char *sendbuf = (char*)&buf; sentbytes = sendto(sock,sendbuf,strlen(s...

Converting integer hex format into strings

Hi everybody, I am programming an application to send data using UDP sockets with Python 3.1. The command socket.send requires data in bytes format. The problem I am having is that the package I have to send has three different fields, the first one contains a 16 bits integer variable (c_ushort) and so does the second field whereas th...

C# Getting sender address from UDP message

I have an embedded Ethernet interface (Lantronix XPort) that responds to a UDP broadcast with its identifying information. I am able to multicast the "magic packet" and datagrams are received by the listener correctly, however I also need to find out what IP Address send that response datagram. If it were TCP, I would do socket.RemoteEn...

PHP Socket Server (for Android Push Notifications) - Security / Authentication Issue

Hello all... I have recently written a socket server in PHP that will be handling communication between an Android phone application and my PHP webserver. Due to the fact that Android doesn't natively support push style notifications we are going to be using our webserver as the middleware layer to handle our 'pushes'. The socket se...

UDP socket network disconnect behavior on Windows-Linux-Mac

Hi folks, I made an application using boost.Asio using UDP multicast. I don't think the question is really specific to boost.Asio but to sockets programming in general, since boost.Asio's network facilities are mostly wrappers to socket functions. I constructed the application based on the multicast examples ( http://www.boost.org/doc/...

Max socket connections of one process UNIX

I have a java server (1 process) that spawns a thread for every incoming connection. I know there is a file descriptor limit of 1024 that's compiled into the kernel. Is there a limit to how many socket connections 1 process can support? ...

How to use select() in chat client program in C socket programming ?

I'm newbie. I want to make the client program to receive input from keyboard and data from server. I don't want if while user type something (scanf) and its block to receive data from server. How to write the code in C ? Thank you. ...

Python socket module: http proxy

Hello I'm trying to use protected http socks server with socket module as in the code shown below >>> import socket >>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >>> host = 'http://user:[email protected]' >>> port = 8888 >>> s.bind((host, port)) It gives me error: socket.gaierror: [Errno -2] Name or service not known Th...

Using linux sockets the QT way?

I have been googling this, but I can't seems to find it. Is there a QT way to use linux sockets? It looked like the QSocket class is used for network sockets and not for local linux sockets. Anyone knows anything about this? And maybe a tutorial to get started? ...

Should I connect directly to CouchDB's socket and pass HTTP requests or use node.js as a proxy?

First, here's my original question that spawned all of this. I'm using Appcelerator Titanium to develop an iPhone app (eventually Android too). I'm connecting to CouchDB's port directly by using Titanium's Titanium.Network.TCPSocket object. I believe it utilizes the Apple SDK's CFSocket/NSStream class. Once connected, I simply write: ...

Android service for TCP Sockets

Based on a suggestion in a previous question I asked on here, I'm trying to push my socket connection for an application that I've written into a service. I spent the better part of the day yesterday researching services and actually mocked up a few (one remote, one local). My question is in two parts: 1) after having played with both...

Missing bytes in sending files over TCP connection

Some bytes are missing when I'm sending files over TCP connection. Though there are times that file transfer is complete. Sending side: class SendFile extends Thread { Socket s; String toIP; String fileName; PrintWriter pw; BufferedReader br; String fromIP; String nextHopIP; String transferTime; int routingIndex; final int bufferSize ...