tcp

Best way to check if a TCP connection is active

Given a list of IP addresses how do I programmatically check if the local machine still has active TCP connections to these IP Addresses? I am using C#. ...

Socket-Programming

Ok guys I've racked my little brain and have been unable to find a solution. The problem here is that I am being able to call begin-receive once, but after that I am unable to find a proper technique by which the method can be called again and again. Consequently although a connection is being made,messages can be received just once and ...

TCP and POSIX sockets accept() semantics

Situation: The server calls accept(). The client sends a SYN to the server. The server gets the SYN, and then sends a SYN/ACK back to the client. However, the client now hangs up / dies, so it never sends an ACK back to the server. What happens? Does accept() return as soon as it receives the SYN, or does block until the client's ACK is...

How to deliver instance of object to instance of SocketServer.BaseRequestHandler?

This is problem. My primary work is : deliver "s" object to "handle" method in TestRequestHandler class. My first step was : deliver "s" object through "point" method to TestServer class, but here im stuck. How to deliver "s" object to TestRequestHandler? Some suggestions? import threading import SocketServer from socket import * clas...

Best client/server UPD and TCP debugging tool?

I'm trying to find a simple TCP/UDP debugging tool. The tool should act like a client or a server, display incoming messages, allow sending messages, etc. Ideally, the tool would have a GUI and be extremely easy to use. For the life of me I can't find anything adequate. All tools I tried either truncate messages, inject dummy messages i...

Secure Serialization

I'm writing a client/server that will allow Customer Data to be shared between our head office and on-the-move sales folks within the company. The server downloads and writes the customer data in XML files but also keeps the data in memory so that it can act as a local client as it were. I'm planning to Serialize the ArrayList so that ...

Detecting EOF / TCP teardown using Java sockets from Javascript

I'm creating a Java socket in Javascript, sending an HTTP request and receiving a response correctly but I seem to be unable to detect an EOF or the server closing the socket at the end. What am I doing wrong? The problem is we never exit the outermost while loop - the server stops transmitting and (presumably) closes its end of the conn...

Client/Server both give up after 1 connection

I'm writing a client/server (as many of you probably already know!). The server is going to be sending data to the client. However, the client can connect once and after that it never attempts to connect again once the connection has been terminated. Similarly, once the server has sent it's message it will ignore future attempts to conne...

Simple server/client boost example not working

Learning boost, and compiled their daytime server client example. Since I cant use port 13 that is in the example I only changed the port numbers in the server and client example. Server runs fine, but the client doesnt connect it seems, and no error is given. Input data for the client is "127.0.0.1". Server: #include <ctime> #include...

Behavior of connect() with TCP

I call connect() on the client. The client enters the SYN_SENT state and sends a SYN. Now it gets a SYN with no ACK in it, so the client enters the SYN_RCVD state. Does connect() return at this point? Technically you have enough information to be able to call send() and recv() on the socket. The RFC itself says, if you call SEND on a s...

Boost, sending files over the network using tcp, prefered method ?

In the boost examples in the documentation, tcp:iostream is used to very simply send streams over the network. In other examples write() is used to write data to the socket instead with a bit more code involved. What is the difference between those 2 methods? Pros and cons? Is there something else that should be used instead ? ...

TCP Socket.Connect is generating false positives

I'm experiencing really weird behavior with the Socket.Connect method in C#. I am attempting a TCP Socket.Connect to a valid IP but closed port and the method is continuing as if I have successfully connected. When I packet sniffed what was going on I saw that the app was receiving RST packets from the remote machine. Yet from the traci...

C# - a userland TCP stack in Windows XP SP III

Hi! I'm trying to create an application to craft packets to be able to debug some gateways here, and to experiment with TCP DoS situations. Nevertheless this should be very easy, I didn't find a way to implement this for a Windows application. I started using Impacket from Core Security in Python on a Unix box, but I want to avoid thi...

Iterating a read() from a socket

Is this the proper way to iterate over a read on a socket? I am having a hard time getting this to work properly. data.size is an unsigned int that is populated from the socket as well. It is correct. data.data is an unsigned char *. if ( data.size > 0 ) { data.data = (unsigned char*)malloc(data.size); memset(&data.data, 0, data...

More TCP and POSIX sockets listen() and accept() semantics

Situation: The server calls listen() (but not accept()!). The client sends a SYN to the server. The server gets the SYN, and then sends a SYN/ACK back to the client. However, the client now hangs up / dies, so it never sends an ACK back to the server. The connection is in the SYN_SENT state. Now another client sends a SYN, gets a SYN/AC...

Behavior of shutdown(sock, SHUT_RD) with TCP

When using a TCP socket, what does shutdown(sock, SHUT_RD); actually do? Does it just make all recv() calls return an error code? If so, which error code? Does it cause any packets to be sent by the underlying TCP connection? What happens to any data that the other side sends at this point - is it kept, and the window size of the con...

listen() without calling bind()

I tried the following: int sockfd = socket(...); listen(sockfd, 10); accept(sockfd, ...); None of the calls failed, and the program just started blocking as if I had called bind(). What will happen in this case? Will it just be impossible to ever receive a connection, since it has no local address or port? Or was it implicitly assigne...

How do you unit-test a TCP Server? Is it even worth it?

I'm developing a small TCP server, which will process some TCP packets and behave differently based on the request. How can I write unit test for this? If it's really hard to write, is it even worth the effort? ...

JAVA - Difficulties with a simple server seeing the clients

Hello, I am trying to make a simple game that goes across a TCP network. The server does something like this to check for connections, in Server.java: try { server = new ServerSocket(port); System.out.println("Server started on port " + port); while (true) { socket = server.accept(); System.out.println(...

Which method is better for sending a stream of images between two processes, local TCP/IP connection or Interprocess communication?

Assuming that I have to copy each image on the stream (I cannnot simply access that data with any mutex protection, it must be copied anyway), which method is better, pros/cons? I would like to know also how much performance loss this implied compared to using the images in the same process. Thanks ...