sockets

What can cause a spontaneous EPIPE error without either end calling close() or crashing?

I have an application that consists of two processes (let's call them A and B), connected to each other through Unix domain sockets. Most of the time it works fine, but some users report the following behavior: A sends a request to B. This works. A now starts reading the reply from B. B sends a reply to A. The corresponding write() cal...

Reusing socket descriptor on connection failure

In my client code (Linux), I am following these steps to connect to a socket: Creating a socket sockDesc = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) Connecting it (retry for 'x' time in case of failure) connect(sockDesc, (sockaddr *) &destAddr, sizeof(destAddr)) (After filling the destAddr fields) Using the socket for se...

NSStream SSL on used socket

I am writing an application that uses NSStream's SSL functions on the iphone. I know that SSL is working because I can directly connect servers using SSL. I have encountered a problem where protocols that use starttls require me to communicate on the socket with unsecured, send the starttls command and then reuse the same socket for SSL....

C: non-blocking udp socket: what do I get?

Hi there, I have a problem in understanding what recv()/recvfrom() return from an non-blockig UDP socket. A bit more specific and compared to TCP (please correct me if I'm wrong): A blocking socket (either TCP or UDP) won't return from a recv() until there is some data in the buffer. This could be some number of bytes (TCP) or a comp...

How to produce struct addrinfo from struct sockaddr?

I have a struct sockaddr and need to make a struct addrinfo (specifically that, because that's what some other API wants). The IP address may be IPv4 or IPv6. What's the best way to handle that? ...

Only one usage of each socket address (protocol/network address/port) is normally permitted

Hello All, I am connecting to TCP/IP port in Asp.Net, basically i have attached a device on this port to which i am reading, it is working fine but on second time when tcp listener tries to start then it generates the above error. can any body guide me how can i get rid of this error here is my code that i am using to connect to TCP/IP ...

Does anyone know a SSH/ SFTP/ FTP wrapper around pfsockopen()??

Does anyone know a SSH/ SFTP/ FTP wrapper class around pfsockopen();?? I'm still on my quest to keep persistent connections in PHP. ...

TCP stuff never works for me

Hi All I am trying to get a little client/server thing going just to learn how to do it... But after using many samples, following several tutorials even on msdn, none of them have ever worked. I keep getting the following exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively re...

SCTP with Multihoming as a Drop In Replacement for TCP

SCTP has native multi-homing support which if I understand it correctly will automatically reroute your packets over a secondary NIC if the primary interface goes down. I duplicated this functionality with TCP by writing a custom routing deamon to modify the routing tables if my primary NIC goes down. I would like to try using SCTP ins...

Select returning 0 on a closed SCTP socket

This is related to the question: SCTP with Multihoming as a Drop In Replacement for TCP I have a simple echo client / concurrent server app that ran perfectly fine using TCP. I could pipe a file to stdin on the client and the client would receive all the data back, call select which would return 1 indicating the socket was readable, t...

Cocoa AsyncUDPSocket framework, (long)tag variable explanation and my delegate only sometimes called.

Hello Community, my first post and also my first question. I am currently playing around with the Artnet protokoll, which is based on UDP. Trying to develop an Cocoa Application that reads Artnet data. I decided to use the AsyncUDPSocket Cocoa framework and got it working somehow.. So when i try to send a packet to my listen port using...

EADDRNOTAVAIL when binding 127.0.0.1 on localhost?

I'm getting errno==49 (EADDRNOTAVAIL) when trying to UDP-bind() to 127.0.0.1:47346 running Mac OS X on a G5 (big endian PowerPC). Is there something preventing me from doing so? I've tried other addresses and ports (192.168.1.2 and port 47346) but with no success. Here's a gdb printout of my sockaddr_in: $1 = { sin_len = 0 '\0', s...

Only one usage of each socket address (protocol/network address/port) is normally permitted

hello everybody, i am working on a project which uses socket programming.but when using the same socket for multiple number of times even after closing down the listener() at each time i use the socket.when i run the application it gives the error as the above.i am really worried about it.if somebody can help me out.thanks in advance. ...

I am trying to use java socket, but netbeans does not see the main classes. Could someone please tell me what i am doing wrong?

package doslab2_datagram; import java.io.*; import java.net.*; import java.util.*; class client { public static void main(String args[]) throws Exception { Scanner scan = new Scanner(System.in); DatagramSocket clientSocket = new DatagramSocket(); InetAddress IPAddress = InetAddress.getByName("localhost"); byte[] sendDat...

Multi-threaded network UDP server library for .net

Is there something like twisted (python) or eventmachine (ruby) in .net land? Do I even need this abstraction? I am listening to a single IO device that will be sending me events for three or four analog sensors attached to it. What are the risks of simply using a looped UdpClient? I can't miss any events, but will the ip stack handle t...

Performance issue using Javas Object streams with Sockets

I'm trying to do local IPC using Sockets and Object streams in Java however I'm seeing poor performance. I am testing the ping time of sending an object via an ObjectOutputStream to receiving a reply via an ObjectInputStream over a Socket. Here's the Requestor: public SocketTest(){ int iterations = 100; try { Socket s...

(How) Can I reduce socket latency?

Hello, I have written an HTTP proxy that does some stuff that's not relevant here, but it is increasing the client's time-to-serve by a huge amount (600us without proxy vs 60000us with it). I think I have found where the bulk of that time is coming from - between my proxy finishing sending back to the client and the client finishing rece...

winsock 2. thread safety for simultaneous send's. tcp

is it possible to have multiple threads sending on the same socket? will there be interleaving of the streams or will the socket block on the first thread (assuming tcp)? the majority of opinions i've found seems to warn against doing this for obvious fears of interleaving, but i've also found a few comments that state the opposite. are ...

Why am I losing this byte in the send() function?

Our application is a C server (this problem is for the Windows port of said server) that communicates with a Windows Java client. In this particular instance we are sending data to the client, particularly, the message consists of a 7 byte header where the first 3 bytes all have a specific meaning (op type, flags, etc) and the last 4 by...

Differentiating Between Two Computers On The Same Intranet

I am trying to create a Socket "Hello World" program. I would ideally like to create two programs who can exchange simple text, peer-to-peer. I can create a webservice that the peers can post their IP Address to. One peer can then select another to pair up with. If one of the peers is my desktop computer, and the other is my laptop, ...