sockets

Unable to connect to my Jabber server (EJABBERD) from console

Im working with Ejabberd on OS X 10.6, with rails. I am able to connect to my ejabberd server web console on port 5280 without problems and also connect to it using iChat jabber client. But i am unable to connect to it from the console and end with a u.connect results in RESOLVING: _xmpp-client._tcp.sid-laptop (SRV) CONNECTI...

Where to get specification for keep-alive in sockets in .NET?

Hi, I'm trying to find out how exactly keep-alive works in .NET but link from here doesn't work. Could anybody post a link with specification? What I'm looking for: I would like to know how often are the keep-alive packets sent. Do I have to set KeepAlive via command: s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Ke...

Amazing error in perl

i write this perl code : use HTTP::Request::Common qw(POST); use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $req = POST 'http://example.com', [ hfc /[pos]/ => 'yayaya' ]; $content = $ua->request($req)->as_string; but when i compile it i get this error : syntax error at C:\Documents and Settings\ysys\ya.pl line 5, near "/ =...

Sending UDP packets on iPhone fails over a fresh new 3G connection, but works otherwise

I'm having a strange problem when sending UDP packets from an iPhone over a 3G. Almost every time my application starts after a longer period of network inactivity (for instance after the phone comes from the sleep mode or it just gets a 3G connection), my application is not able to send any UDP packets. I get a kCFSocketError error stat...

Creating client and server sockets in the same file

Hi, I would have to design a job scheduling system which works like - users (clients) would deposit jobs (executables) to a server. I have three files - client.c, jobQ.c and server.c. The jobQ would take client requests, and send them to the server on specific timestamps (if a user wants to run job X on server Y at 07-29-2010 3:34 AM, t...

how TCP port bind

Hi, Any body knows how is the port number bound with a socket in detail and how is the port used to forward the packet received in transport layer to a socket which is reading on this port? thanks. ...

How to cancel waiting in select() on Windows

In my program there is one thread (receiving thread) that is responsible for receiving requests from a TCP socket and there are many threads (worker threads) that are responsible for processing the received requests. Once a request is processed I need to send an answer over TCP. And here is a question. I would like to send TCP data in ...

Nodejs streaming

Hello. I want to realize a simple client-server connection using Nodejs. But I've encountered with the following problem. Consider the code server.js: var net = require('net'), sys = require('sys'); net.createServer(onConnection).listen(8124); function onConnection(socket) { socket.setNoDelay(true); socket.ad...

Is raw socket on loopback interface possible?

We are trying to communicate with the server listening on Linux loopback interface via raw socket and it seems like the server does not get a single packet from us. The packets we send are visible in Wireshark. Is raw socket on loopback possible at all? (Please, don't ask why we need it: it's too complicated to explain here) EDIT: this...

Reading single byte with Asio::read

Hi. Is it possible to read a single byte via asio::read? I'm getting a single byte response and it seems wasteful to use the current buffering code: //Read the 1 byte reply char buffer[1]; size_t bytesRead = asio::read(s, asio::buffer(buffer, 1)); if(bytesRead < 1) return false; Thanks. ...

Explain basic PHP Socket server code

Hi so I'm trying to lurn how to make a chat with a socket server. I noticed everybody uses the same code (ripoff from the zend developer zone). The problem is no one really explains how it works. Especially the cryptic code after while(true) { . This would benefit many so i hope someone could take the time and explain the code in de...

How to determine if an HTTP response is complete

I am working on building a simple proxy which will log certain requests which are passed through it. The proxy does not need to interfere with the traffic being passed through it (at this point in the project) and so I am trying to do as little parsing of the raw request/response as possible durring the process (the request and response ...

Android - Inter thread communication and network socket

Hi this is what I am trying to achive 1) My main application/activity starts a thread to listen to network messages (tcp). But I want this thread to listen to network messages (on tcp socket) as well as messages from main activity. I am exploring if I can use socket for network messages and Looper for internal messages. I dont think it...

C++ printf large buffer

The problem I am having is printf doesnt print all the data that is being returned from a client response. (verified data is being sent back via packet sniffer) #define MAXBUFFER 24576 char buffer[MAXBUFFER]; ...... datastream = read(sock,buffer,MAXBUFFER - 1); printf("%s",buffer); ...... What is the best approach to printing all t...

python receiving from a socket

So I have a simple socket server on an android emulator. When I'm only sending data to it, it works just fine. But then if I want to echo that data back to the python script, it doesn't work at all. Here's the code that works: android: try { serverSocket = new ServerSocket(port); } catch (IOException e1) ...

How to write a huge string to a NetworkStream?

Hi all, From the internet I got the way to read a huge string from a NetworkStream. static NetworkStream ns = null; static StringBuilder sb = null; static byte[] buffer = null; static int position = 0; //....................................... //other codes skipped for simplicity //....................................... priv...

How to gracefully shutdown socket in C#

I have a TCP client/server application. 1) server is listening on a port 2) client send request and server accept the connection 3) send receive operation performed 4) server tries to disconnect the connection (first Shutdown then Close) 5) connection state changed to TIME_WAIT 6) the next time client open another socket but sending do...

Transfering data using Sockets on the iPhone using SSL/TLS

Hi, I've been asked to prototype an application which share information with a server via sockets using SSL/TLS. I've been asked to make the application in both C#(MonoTouch) and ObjectiveC(Cocoa). I've been successful with the MonoTouch route, and developed a fully working client server pair, which can communicate and share data secur...

How to flush the socket using boost

I am implementing a server that sends xml to clients using boost. The problem I am facing is that the buffer doesn't get sent immediately and accumulates to a point then sends the whole thing. This cause a problem on my client side, when it parses the xml, it may have incomplete xml tag (incomplete message). Is there a way in boost to...

Socket performance on linux

Following on from my last question: http://stackoverflow.com/questions/2251051/performance-issue-using-javas-object-streams-with-sockets I'm looking at socket performance on Linux. With the above example I get a round trip time of ~65μsec. If I make two fifos on the file system this goes down to ~45μsec. The extra time using localhost...