tcp

How can I keep the kernel from sending RST packets from raw sockets on mac os x?

I am using raw sockets with TCP. Whenever a packet gets sent to me, my computer send a RST packet back. I tried http://udi.posterous.com/suppressing-tcp-rst-on-raw-sockets, which isn't working: int main(void) { struct addrinfo *info, hints, *p; int status, sock; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; h...

TCPServer socket in ruby

hi, I would like to establish a connection between 2 computers using socket. For this purpose one of them is a server and this is the code I've write: sock= TCPServer.open('localhost', 6666) sock.accept the client try to establish the connection: client = TCPSocket.open(ip_server, 6666) but is not working. I've notice scanning serv...

Shutting down gracefully from ThreadingTCPServer

I've created a simple test app (Python 2.6.1) that runs a ThreadingTCPServer, based on the example here. If the client sends a command "bye" I want to shut down the server and exit cleanly from the application. The exit part works OK, but when I try to re-run the app, I get: socket.error: [Errno 48] Address already in use I tried th...

How to get an IP address from Socket

I am trying to get an ip address that is bound to receiveSock. How can i get it. Ques 1: ipEndReceive = new IPEndPoint(IPAddress.Any, receivePort); receiveSock = new Socket(AddressFamily.InterNetwork , SocketType.Stream, ProtocolType.Tcp); receiveSock.Bind(ipEndReceive); When code reaches Bind function. An er...

How to get an ip address from an IPEndPoint obtained in a socket.

ipEndReceive = new IPEndPoint(IPAddress.Parse("127.0.0.1"), receivePort); receiveSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream , ProtocolType.Tcp); ErrorLog.WritetoErrorlog("Trying to Bind IP Address Stored in Variable : " +ipEndReceive.Address.ToString() ...

Triggering 'connection reset by peer'

I would like to test the logging that happens in our app (an embedded ftp server) when a 'connection reset by peer' error occurs. This post explains the source of the error pretty well, but doesn't really explain how to cause one. Does anybody know a way to trigger this error for a TCP connection? ...

C# TCP listener

Hello all, I don't want to reinvent the wheel with another TCP server wrapper, so are there any good out of the box open source TCP server wrappers for .NET C#? Indy C# is kinda dead, and I cannot find any other packages that are atleast a bit maintained.. ...

how to disable Nagle algorithm on TCP connectio on iPhone

Hi I'm building a socket , using CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (CFStringRef) yourHostAsNSString, yourPortAsInteger, &myReadStream, &myWriteStream); and I s...

tcp connection from unix to java

Hello everybody. I'm looking for something,I don't know if it exists. I have a Java server, something like while (true) { try { Socket socket = server.accept(); new ConnectionHandler(socket); System.out.println("Waiting for a new client message..."); } catch (IOEx...

why do we need to store sessions in a database sometimes?

I was told that one common reason of storing sessions in a database is to make it cross-server. But isn't a TCP connection persistent until one closes the browser? Why the next request may switch a different server? ...

What's the redundant data in TCP packet?

I am reading "Unix Network Programming" and tcpdump the packet generate by the example. The example is just send out a packet contain string "liha". I read the TCP/IP RFC and found normal IP header is 20B. and normal TCP header except data is 24B. So, there are 8B before string "liha" in the captured packet. Are "0121 3d2a 0120 b43e" ...

How to wait until your TCP message has been ACKed

Background: We have a client/server application that uses a persistent connection to the server. Benchmarks show that it is many times faster to use an already open connection rather than spend significant time (2.5 seconds) setting up a new connection (crypto). Unfortunately, the old connection may be stale. Is there a way to wait f...

Need assistance with TCP Reverse connection

I am creating an authentication server for some projects I'm working on. This authentication server works by receiving and transmitting data to users trying to authenticate. The user can send data to the server succesfully but when sending back it requires port forwarding. I read a way that I would not require port forwarding by using r...

[Qt] I'm trying to make server/client but I don't know how to connect signals and slots

Hello, I'm trying to make server/client in Qt. TCP Server takes maximum 4 connections from client. To create... // server.h class Server : public QTcpServer{ ... QList<QTcpSocket *> list; } // server.cpp Server::start(){ QTcpSocket *curr = nextPendingConnection(); connect(curr, SIGNAL(disconnected()), curr, SLOT(delet...

keeping 1000 tcp connections open inspite of very few(10/20) actual communications.

For a socket server, what are the costs involved in keeping 1000s of tcp connections open, but only few clients are actually communicating? I'm using single threaded poll/select based server. Also, what is the max open-socket limit of linux kernel(plz don't give conf file suggestions. i want theoretical limit)? ...

Byte to String Python 3 Websockets

Hey. I'm converting a 2.6.5 application to python 3.1. I'm trying to convert a byte order received through socket.recv() into a string, by doing the following: str(temp, 'UTF-8', 'ignore') The problem is unknown characters are removed ("ignored"), such as \x00 and \xff (WebSockets characters), I do want to convert the byte order to a ...

What is a decent book about usage of TCP/IP protocol in C#?

Hello, I'm looking for a book that covers TCP protocol from TCP/IP family and contains examples in C#. I've found this one: http://www.amazon.com/TCP-IP-Sockets-Practical-Programmers/dp/0124660517 - It seems good. The only drawback is that it's written in .NET 1.1 or so Thanks for tips! ...

TCPClient seems to not maintain a keep-alive connection, why?

I have the following code using the TcpClient byte[] encbuff = System.Text.Encoding.UTF8.GetBytes("username" + ":" + "password"); string follow = "track=soccer,twitter"; byte[] encode_follow = System.Text.Encoding.UTF8.GetBytes(follow); using (TcpClient client = new TcpClient()) { string requ...

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 ...

Is out there any sample of reading http requests using TCP socket collecting data from them (like emulating Http server in some way)

Is out there any sample of reading http requests using TCP socket collecting data from them (like emulating Http server in some way) so I wanna to keep data like senders IP:PORT, request body and so on. So has any one seen such thing in OpenSource projects or do you know how to create it? (if so please provide siple code example) ...