sockets

Java network server and TIME_WAIT

I have run into a problem with a network server that receives signals from devices my company produces. The device will occasionally reuse the source port that it had just used. This causes the SYN to be dropped by the server. The device then retries until the old socket falls out of TIME_WAIT on the server. The server then SYN-ACKs....

Why is php's fsockopen returning (Resource temporarily unavailable)?

I have a very simple server php code like this function listenForClients() { $this->serviceConnection = socket_create(AF_UNIX, SOCK_STREAM, 0); socket_bind($this->serviceConnection, "\tmp\mysock", 0); socket_listen($this->serviceConnection, 10000000); while($clientSocket = socket_accept($this->serviceConnection...

Why do I get connection refused after 1024 connections?

I am testing on a local Linux server with both the server and client in the same server. After about 1024 connections, in my code, where I connect, I get connection refused. At first I thought it was the fd_set_max limit of 1024 for select and changed the server to do poll instead of select and I still don't get past this number. My ulim...

how do I pass a byte[] reference as the buffer in a System.Net.Sockets.Send().Recieve()

Hi there, I have been reading about the various memory management issues that .NET Asynchronous Sockets have. There are but a handful of links, but spidering this one will get you them all: http://codebetter.com/blogs/gregyoung/archive/2007/06/18/async-sockets-and-buffer-management.aspx Basically when a socket is asynchronously sendin...

What HTTP signatures are encountered from Google web crawling robots ?

Hi there, With all HTTP data available,What 'signs' can you look for to recognize Google's search engine robots? ...

Create a new independent process from another C process

Two C executables A and B exist. A and B communicate to each other through a socket. B can be started independently or through A. If B is started first and A is started next, then A and B start properly without issues. Even if A is restarted, then there are no issues. If B is started through A, then A and B starts properly. But here ...

How many connections/s can I expect between PHP and MySQL on separate server?

Trying to separate out my LAMP application into two servers, one for php and one for mysql. So far the application connects locally through a file socket and works fine. I'm worried about the number connections I can establish if it is over the network. I have been testing tcp connections on unix for benchmark purposes and I know that ...

how to write data to socket in blackberry

I am sending data to server twice. first i send "Hello world" then I send "Server". But server recieved the data at 1 read. but server have to read the data in two read operation. Also I write the data then read data from server then I write the data In this case server can read the first data. but server can not read the second data se...

TLS/SSL in .net

Hi there! Is there any (hopefully free/open source) code available that does native TLS/SSL communication? I do not speak about the HTTPListener/Client and WebRequest classes. I'd like to do raw TLS communication in my C# code. Thanks in advance, Max ...

Reading from a socket 1 byte a time vs reading in large chunk

What's the difference - performance-wise - between reading from a socket 1 byte a time vs reading in large chunk? I have a C++ application that needs to pull pages from a web server and parse the received page line by line. Currently, I'm reading 1 byte at a time until I encounter a CRLF or the max of 1024 bytes is reached. If reading ...

PHP CLI: reading a line from a socket and stripping telnet control characters

I want to read a line (ending with \x0D\x0A) from a PHP socket, and strip the telnet control charaters (IAC, WILL, DO, etc) from it. Currently I'm using this: <?php // snip function socket_readline($socket, $echo = true) { $buffer = ""; $bufsize = 0; $length = 4096; $need = $length; while ($bufsize < $length) { ...

Socket Timeout in C++ Linux

Ok first of all I like to mention what im doing is completely ethical and yes I am port scanning. The program runs fine when the port is open but when I get to a closed socket the program halts for a very long time because there is no time-out clause. Below is the following code int main(){ int err, net; struct hostent *host; stru...

read all data recieved from a socket in PHP

I'm writing a simple telnet client library. I open sockets using fsockopen() and read and write to the socket using fgetc() and fwrite(). I use fgetc() instead of fread() to handle Telnet special commands and options like (IAC, ...). the problem is that most of times I'm reading from the socket, it takes too long to return. as I have pr...

What does the EIO error code mean?

I'm maintaining web server software on which users can deploy web applications. Web applications run as separate processes: the web server launches a web application process, forwards the HTTP request to the web application, and forwards the web application's response back to the HTTP client. The communication between the web server and ...

Good Client Socket Pool

I need to manage long running TCP socket connections to an external server from my Java application. I'm looking for a good socket pool so I will be able to re-use the sockets. Are there any suggestions? ...

Tips for using commons-pool in production

Based on an answer I got here, I started to give commons-pool a serious look. My last experience of using it was around 2003, probably version 1.1 or 1.2. Its main user, DBCP, is considered by many as flawed and to be avoided. Does anyone uses commons pool in production to write pool of your own? What is the best pool type to use? I pl...

Delphi transparent proxy for a TCP connection

Anyone know of any examples of a TCP sockets proxy application written in Delphi? I am building a small broker application that needs to listen for socket connections on a given TCP port, read a XML data packet sent over the connection, serve the request via TCP to a server chosen from a pool of available back end servers, and deliver th...

From C++ wchar_t to C# char via socket

I am currently building a C++ application that communicate via socket to a C# application. My C++ app sends wchar_t* via socket. Here is an overview of what is send : <!-- Normal xml file-- Here is what I receive on the other side (I do a stream.read to a byte array and use UTF8Encoding.GetString() to convert the byte array to a read...

Scaleability of TCP keep-alive

Consider a large scale, heterogeneous network of various devices. These devices are providing services to others on the network in a peer-to-peer fashion. The mechanism used to track service availabilty across all nodes is currently using TCP sockets marked as keep-alive, usually for the duration the node is online. This leads to ever...

Get a random, high port number that is still available.

Suppose I want to run a TCP/IP service on some port for IPC. As I'm passing the port number to the processes I want to communicate with anyway, the port number doesn't matter. What's the best way to get a random, high (usually >49152) port number that is still available from the system? Is there something in POSIX I can use? I know FTP ...