sockets

(ruby) ruby sockets: how to create a POST request?

How does one create a POST request using TCPSocket in Ruby? Is there a special format to making a post? I have the following but I get a parse error (it's for a rails server): require 'socket' s = TCPSocket.open("localhost", 3000) s.puts("POST /<controller>/<action> HTTP/1.1") s.puts("Host: localhost:3000") s.puts("Content-Type: applic...

Silverlight 4 and TCP Sockets

Most of the software we develop has to communicate with hardware devices in the local network using TCP/IP, UDP/IP or serial ports. This is probably the only reason we still target WPF instead of Silverlight for our UI. Socket support in Silverlight 2/3 is poor at best and way to limited. I've read the updated desktop mode in Silverligh...

Question about what I should have before Connect

I have this included: #include <sys/socket.h> /* for socket(), connect(), send(), and recv() */ /* Establish the connection to the echo server */ if (connect(sock, (struct sockaddr *) &echoServAddr, sizeof(echoServAddr)) < 0) DieWithError("connect() failed"); But I am getting this: TCPClient.cpp:395: error: no matching func...

NNTP & Socket - How to interrupt?

Hi. I'm sending a message to a NNTP server in order to fetch an article's body. I don't want to wait for the answer to complete, cause I only need the first 3 lines from the body. How can I interrupt the transfer and move on to the next article? Now when I request another's article message body, I still get data from the previous one. T...

Question about how to send images in socket programming?

I've got a couple questions about sending images over. How do I handle different types of files, jpeg, png, etc. If the file is large, I ave to use sequence numbers... but I don't know how to stop recving if I do not know the number of sequence numbers. My knowledge of transfering images / files is next to none. I have never programme...

How to get the address of the DNS server that getaddrinfo queries

Hello all, I'm newbie to BSD socket programming in C. I can query a web address to get its associated ip addresses with "getaddrinfo" function. But i want to know which dns server getaddrinfo queries this information from. ...

Zero Window when sending files through posix sockets

Hi I have a problem - when I'm trying to send huge amounts of data through posix sockets ( doesn't matter if it's files or some data ) at some point I don't receive what I expect - I used wireshark to determine what's causing errors, and I found out, that exactly at the point my app breaks there are packets marked red saying "zero windo...

Send A DataSet via Sockets in .NET

I had written a Web Service to return a DataSet back to my ASP.Net site and this was working fine. However due to security issues and also the ability to get certain references installed, I have to move this to an App Server and so doing it as a Windows Service and communicating with the ASP.Net site now via sockets. Is there a way I c...

ejabberd ip address

Does anyone know if there's a direct way to map an IP address to a user logged into ejabberd? I found an indirect way by modifying ejabberd_receiver.erl and calling inet:peername(Socket) from here: http://stackoverflow.com/questions/1240312/determining-ip-address-and-port-of-an-incoming-tcp-ip-connection-in-erlang but there doesn't see...

C# socket vs c++ Socket, which is better?

I have a server-side project which must be developed on .Net platform, but I doubt about the c# socket performance, some guys told me that C# application always eat a lot of memory, especially when constantly exchanged large bunch of data in real time. the memory data recycle is too slow. anyone give some ideas about C# socket performanc...

Sending UDP packet in Linux Kernel

Hi Guys, For a project, I'm trying to send UDP packets from Linux kernel-space. I'm currently 'hard-coding' my code into the kernel (which I appreciate isn't the best/neatest way) but I'm trying to get a simple test to work (sending "TEST"). It should be mentioned I'm a newbie to kernel hacking - I'm not that clued up on many principles...

Python: How to shutdown a threaded HTTP server with persistent connections (how to kill readline() from another thread)?

I'm using python2.6 with HTTPServer and the ThreadingMixIn, which will handle each request in a separate thread. I'm also using HTTP1.1 persistent connections ('Connection: keep-alive'), so neither the server or client will close a connection after a request. Here's roughly what the request handler looks like request, client_address =...

Receiving a response through UDP

Hello. I have seen applications send a packet through UDP to an IP on some port and receiving a response. Which port does the response go to? (Btw, how can the router know that the response is for my PC, if there are no ports forwarded to my PC?) Greetings, Neo_b ...

Tips / Examples on sending an Image file (jpeg, png) over socket programming?

I've heard that we can somehow send an image file with binary over a socket... But I have no idea on how to convert an image file into binary or how to even think of sending it over a socket... Was hoping if someone could post a simple example? or point me in the right direction :) I am also using QT for just my gui, but not using QT so...

How do I convert an image into a buffer so that I can send it over using socket programming? C++

How do I convert an image into a buffer so that I can send it over using socket programming? I'm using C++ socket programming. I am also using QT for my Gui. Also, after sending it over through the socket, how do I put that image back together so it can become a file again? If someone could put up some sample code that would be great ...

NSStream reading\writing outside the delegate method handleEvent:eventCode

Hi, in an iPhone app, I have a socket connection through wifi, and I need to read from inputStream and write to outputStream. The problem is that stream management is event-driven, and I have to wait for event NSStreamEventHasBytesAvailable before reading. So I can't know when reading\writing outside the handleEvent:eventCode delegate me...

Java server-client | server wont receive second request

I'm trying to write a client and time server for an assignment and I'm having trouble getting the server to receive the second request from the client. The first request goes through fine without a hitch. then it just stalls. I'm actually pretty lost in this whole thing and rather uncomfortable with java still, so I have no idea what I'm...

SetHandleInformation() Linux equivalent

Hi, for a TCP Server Class I need a Linux function, which does what SetHandleInformation(, HANDLE_FLAG_INHERIT, 0) do under Windows. I've already searched the web after a Linux equivalent, but I didn't find anything useful. The only reason I need that function is to make the socket handle inheritable to child processes. So in case there...

Looking for a solid client side sockets library

Nothing too fancy, but the following would be nice for .NET: Be able to instantiate the object and hook up the MessageReceived and ConnectionChanged events (or ones with similar purposes). Be able to send data (duh) When data is received, it fires the MessageReceived event on the same thread that the object was created on (this would b...

FlashLite 2.x/3.0 Cross Domain policy file

As per my understanding of the Adobe docs for a cross domain request by an swf, two types of policy files are required on the server: URL policy file: this is named "crossdomain.xml" and stored in the root of the server and is generally an http request to the server. System.security.loadPolicyFile("http://foo.com/crossdomain.xml"); So...