sockets

How to correctly handle WSAECONNABORTED in server code?

When a server receives a WSAECONNABORTED from a device (coming in from a send()), should a connection be re-established and data re-sent or should the server bail out and drop the connection? Thanks. ...

Sending large data over sockets in java

Hey all, I am working on client server architecture and i am just beginner in this thing. Here my server is of C and client is of Java and i want to send a binary/database (.db)/image file of size around 10 - 20 MB from C server to the Java client. But data is lost while implementing the following code: Server side C code is: int sock...

TCP performance differences between RH Linux and Solaris in java ?

While comparing java TCP socket performance between RH Linux and Solaris, one of my test is done by using a java client sending strings and reading the replies from a java echo server. I measure the time spent to send and receive the data (i.e. the loop back round trip). The test is run 100,000 times (more occurrence are giving similar ...

Error "No such device" in call setsockopt

Hello, everyone! I need help! I have a code in which send multicast datagrams. A critical piece of code: uint32_t port; int sockfd, err_ip; const uint32_t sizebuff = 65535 - (20 + 8); unsigned char *buff = (unsigned char *) malloc(sizebuff); struct sockaddr_in servaddr, cliaddr; struct in_...

Posix AIO Bad/Broken?

I'm working on a TFTP implementation that is transitioning away from a convoluted multi-threaded implementation to a single-thread/single-process implementation which uses a state machine to track the state of the sessions connected. TFTP is simple enough, and the number of concurrent sessions are small enough that the there really is no...

Socket.Select returns error "An operation was attempted on something that is not a socket"

When calling Socket.Select with lists that are verified to contain only Socket objects, I sometimes receive the error An operation was attempted on something that is not a socket. I can't find a pattern for occurrence. Socket.Select(readList, writeList, null, timeOut > 0 ? timeOut : 0); ...

Java non-blocking IO selector causing channel register to block.

I have two threads that I'm dealing with Java NIO for non-blocking sockets. This is what the threads are doing: Thread 1: A loop that calls on the select() method of a selector. If any keys are available, they are processed accordingly. Thread 2: Occasionally registers a SocketChannel to the selector by calling register(). The proble...

TCP Socket file transfer

Hello, I'm trying to write a secure transfer file program using Python and AES and i've got a problem i don't totally understand. I send my file by parsing it with 1024 bytes chunks and sending them over but the server side who receive the data crashes ( I use AES CBC therefore my data length must be a multiple of 16 bytes ) and the e...

Java - Socket - Freeze

Hi, i've a minimal server which wait until a client connect ,then he start a thread which will send a reply back to the client, the problem is the reply. This is the code of the server: int port = 1234; ServerSocket servSock = null; servSock = new ServerSocket(port); while (true) { Socket link = servSock.accept(); ser...

Best socket options for client and sever that continuously transfer data.

I am using Java (although I think the socket options is implement in most languages) to implement a client and server. The server sends data to the client for processing which the client acknowledges. On another port the client then sends the results of the processing back to the server. When it comes to options such as SO_LINGER SO_KE...

Web Proxy Created in C# needing to prompt for authentication

I worte a little Web Proxy program that uses a TcpListener, which listen on a specific port for web calls. Once it recieves a call it creates a socket, gets the header of the call, forwards it onto the web page requested, reads the response and returns it to the client doing the request. The proxy works lovely, but now I want to limit wh...

Python socket server craps out after receiving data

I'm currently dabbling in sockets. I've got a jquery script that uses a very small flash swf file to establish a true socket connection. As a server I'd like to use python. Everything works, but I can only send information to the server just once. I've tried 2 pieces of python code for the server. I guess since they both have the same ...

Getting TCP Socket statistics in Windows

Is there a way to get a specific socket statistics in windows? I'm most interested in the number of retransmissions a specific socket had, and doing it without using winpcap or similar solutions. Windows should store such an interesting number somewhere, no? ...

Cocoa Distributed Object exception when manually creating remote NSSocketPort

Hi, This is really doing my head in, I hope someone can solve my issue. I'm trying to learn distributed object, bonjour, etc with Cocoa. I can get things up and running but there's just one case that's annoying me, i don't understand why it's happening. I'm trying to setup a DO server that advertise itself with Bonjour. Here's the...

Mocking sockets in java with mockito.

I am trying to mock the following call: s.socket().bind(new InetSocketAddress(serverIPAddress_, serverPort_), 0); so I can test what the rest of the code does when this fails in predictable ways. I use this in my test case: ServerSocketChannel ssc = mock(ServerSocketChannel.class); when(ServerSocketChannel.open()).thenReturn(ssc); do...

vb6 winsock control RemoteHostIP truncates the last digit from IP address

Hi i am writing a socket client/server application in VB6. i have the following code Private Sub sockMain_ConnectionRequest(ByVal requestID As Long) If sockMain.State <> sckClosed Then sockMain.Close End If sockMain.Accept requestID Debug.Print "Accepted connection from: " & sockMain.RemoteHostIP & vbCrLf End...

Unix sockets programming: port is not getting unbound after server shutdown

Hi. I'm studying Unix sockets programming. I made a time server that sends raw time data and a client for it that receives that data and converts it to local time. When I run the server, connect a client to it (which causes both of them to do their job and shutdown) and then rerun the server, I get errno = 98 on bind() call. I have to c...

How does a Linux socket buffer overflow?

I have a Java reader application that reads from a multicast socket on a Linux 64-bit platform (2.6.18). The socket size has been set to 2 MB. When the reader cannot read fast enough the socket "overflows", i.e. packets are dropped from the buffer. What I would like to know is how the Linux kernel drops packets out of the socket buffe...

Open socket connection on a servlet container

Hey, I've written a very simple server that accepts socket connections on a specific port and communicates with clients over that socket. Now I have a client lib which works perfectly fine in J2SE apps. However, if I try to use that lib in a Servlet (the Servlet being the client) to communicate with the server it doesn't work. Unfortun...

Sending data through a socket from another thread does not work in Python

This is my 'game server'. It's nothing serious, I thought this was a nice way of learning a few things about python and sockets. First the server class initialized the server. Then, when someone connects, we create a client thread. In this thread we continually listen on our socket. Once a certain command comes in (I12345001001, for ex...