sockets

(Python) socket.gaierror on every addres...except http://www.reddit.com?

I'm just playing around and I'm trying to grab information from websites. Unfortunately, with the following code: import sys import socket import re from urlparse import urlsplit url = urlsplit(sys.argv[1]) sock = socket.socket() sock.connect((url[0] + '://' + url[1],80)) path = url[2] if not path: path = '/' print path sock.sen...

How can I communicate over TCP sockets from JavaScript?

I'm thinking about how limiting it is for AJAX apps to have to poll for updates, when what would be ideal is for javascript to be able to set up a real two way connection to the server. I'm wondering if there is some method of integrating javascript with a browser plugin that can make a tcp connection so that I could pass data into and o...

Simplest Way To Open and Use a Socket in C

I'm just starting out doing some basic network programming with C, and I found all these things about sockets and they all seem very convoluted. Maybe opening sockets with C is just convoluted itself, but I would like to know the simplest and most effective way to open and write data to a socket in the C programming language. Thanks ...

Why I cannot get equal upload and download speed on symmetrical channel?

Hello, I'm assigned to a project where my code is supposed to perform uploads and downloads of some files on the same FTP or HTTP server simultaneously. The speed is measured and some conclusions are being made out of this. Now, the problem is that on high-speed connections we're getting pretty much expected results in terms of through...

Behavior of SIO_FLUSH

When SIO_FLUSH socket ioctl is used in a Windows environment (in user space), I am confused as to what happens. Does this: (1) completely discard the data from the TCP/IP send queue into a black hole, or (2) push the queued send data across the connection until the buffer is empty, or (3) something else? Thanks! ...

How can I read from an IO::Socket::INET filehandle only if there is a complete line?

When reading from a IO::Socket::INET filehandle it can not be assumed that there will always be data available on the stream. What techniques are available to either peek at the stream to check if data is available or when doing the read take no data without a valid line termination and immediately pass through the read? ...

Detecting loss of connection to fix gateway? (QuickFix)

I'm trying to find a good way to detect a loss of connection. My adapter is implemented as a Fix::Application based on one of the examples. It uses a socket initiator to connect to the fix gateway. When I unplug the internet it takes about 30 seconds for the Fix::Application's onLogout method to be fired. It seems like some underlyin...

Difference between winsock and linux sockets

I'm developing an FTP-like program to download a large number of small files onto an Xbox 360 devkit (which uses Winsock), and porting it to Playstation3 (also a devkit, and uses linux AFAIK). The program uses BSD-style sockets (TCP). Both of the programs communicate with the same server, downloading the same data. The program iterate...

Problems receiving data over a TCP client socket in 'C'

I'm trying to make a TCP Client program in C where the client will start up, connect to a server. Then it will send a little information and then just listen to what it receives and react accordingly. The part that I'm having trouble with is the continuous listening. Here is what I have ... while (1) { numbytes = recv(sockfd, buf, ...

Tips / techniques for high-performance C# server sockets

I have a .NET 2.0 server that seems to be running into scaling problems, probably due to poor design of the socket-handling code, and I am looking for guidance on how I might redesign it to improve performance. Usage scenario: 50 - 150 clients, high rate (up to 100s / second) of small messages (10s of bytes each) to / from each client. ...

IRC Bot: Error - Registration Timeout [fixed]

I'm making a simple IRC Bot in C. And I finally got the bot connecting and receiving information. My code is supposed to be sending as well, but the server is acting as if it is not sending anything. When The bot connects, I receive this: Recieved: :roc.esper.net NOTICE AUTH :*** Looking up your hostname... Recieved: :roc.espe...

Cannot use smtpclient to send mail with localhost iis site

I have an asp.net mvc app running on a local iis website that is failing to send mail using SmtpClient from System.Net.Mail. I am trying to send a mail to my hotmail address and I get a socket exception. Any idea what the problem might be? using(var message = new MailMessage()) { message.From = new MailAddres...

UDP Response

Hi UDP doesnot sends any ack back, but will it send any response? I have set up client server UDP program. If I give client to send data to non existent server then will client receive any response? My assumption is as; Client -->Broadcast server address (ARP) Server --> Reply to client with its mac address(ARP) Client sends data to ...

What is commonly used for Encryption over simple Socket Communications

I have X interfaces to Y computers that communicate over a public network (Think colleges and libraries). I am researching common industry standard techniques for encrypting the data that goes between us. I know there is SSL, but I'd rather find a simple technique that is a "purchase once, install infinite" (trying to keep my variable c...

Determining the TCP port number to which client got bound.

Hi, I create a TCP socket without bothering about the port number to bind to [socket.sin_port = 0]. However later on if I want to print the port number of client how do I do that? The client C application (on Linux) creates many clients which get connected to server. To debug issues I capture the traffic on ethereal. I thought of printi...

Where can I find a list of SocketErrorCode and NativeErrorCode thrown by SocketException?

Hi, A SocketException has a SocketErrorCode and NativeErrorCode. I would like to find a list where these codes (or the common onces) are listed so I can respond in proper fasion. Does anybody know where to find such a list? ...

Does TcpListener.AcceptTcpClient throw uncritical exceptions?

In my application, I currently stop listening when AcceptTcpClient (or EndAcceptTcpClient) throws an exception. Typically exceptions are thrown when I stop the listener (socket error 10004) or when I disconnect the network adapter. try { while (true) { TcpClient client = listener.AcceptTcpClient(); // omitted: st...

Proper way of cancelling accept and closing a Python processing/multiprocessing Listener connection.

Hi! (I'm using the pyprocessing module in this example, but replacing processing with multiprocessing should probably work if you run python 2.6 or use the multiprocessing backport) I currently have a program that listens to a unix socket (using a processing.connection.Listener), accept connections and spawns a thread handling the requ...

How can I pass user credentials through a Unix-domain socket on Mac OS X?

Under many operating systems Unix-domain sockets allow a process to reliably pass its credentials to another process in a way that can't be maliciously subverted. For instance, this is done on Linux through the SO_PASSCRED and SO_PEERCRED options, on FreeBSD by passing messages that include the cmsgcred structure, and on NetBSD by setti...

How can I handle multiple sockets within a Perl daemon with large memory usage?

I have created a client-server program with Perl using IO::Socket::INET. I access server through CGI based site. My server program will run as daemon and will accept multiple simultaneous connections. My server process consumes about 100MB of memory space (9 large arrays, many arrays...). I want these hashes to reside in memory and shar...