sockets

Python sockets buffering

Let's say I want to read a line from a socket, using the standard socket module: def read_line(s): ret = '' while True: c = s.recv(1) if c == '\n' or c == '': break else: ret += c return ret What exactly happens in s.recv(1)? Will it issue a system call each time? I guess ...

Can't bind to low port number (80) on XP sp3

I've got this code in my socket class: bool GSocket::Listen(int Port) { d->Socket = socket(AF_INET, SOCK_STREAM, 0); if (d->Socket >= 0) { sockaddr Addr; sockaddr_in *a = (sockaddr_in*) &Addr; ZeroObj(Addr); a->sin_family = AF_INET; a->sin_port = htons(Port); a->sin_addr.OsAddr = INADDR_ANY; if (bind(d->Socket, &Addr, ...

Linux socket programming debug?

Hi, I have a function just like this: static int rcv_kern(int sock, void *buf, int len, struct sockaddr *addr, socklen_t *addrlen) { struct timeval timeout = {1, 0}; fd_set set; int status; FD_SET(sock, &set); if ((status = select(sock + 1, &set, NULL, NULL, &timeout)) == 0) { FD_ZERO(&set); fprintf(s...

What's the easiest way to grab a web page in C ?

I'm working on an old school linux variant (QNX to be exact) and need a way to grab a web page (no cookies or login, the target URL is just a text file) using nothing but sockets and arrays. Anyone got a snippet for this? note: I don't control the server and I've got very little to work with besides what is already on the box (adding i...

Existing connection close when new TCP connections are made

I have a TCP listener service to which the clients connect. Lately I have started receiving this error related to disconnection. I connect around 20 clients to it and the connection works fine. But when I connect another 10 clients to the service, the previous connections break with a 10053 or 10054 error. Previously it used to run with...

How to know which Local Application Connected to my socket (Windows)

I have a windows services that bind to some TCP port, this port is use for IPC between my application. Is there a programming (WinAPI/WinSocket and etc) way to know which application connected to my port? i.e. in my Windows Services I would like to get a PID of the process that connected to my port. ...

Rebind a socket to a different interface

Is there an existing Linux/POSIX C/C++ library or example code for how to rebind a socket from one physical interface to another? For example, I have ping transmitting on a socket that is associated with a physical connection A and I want to rebind that socket to physical connection B and have the ping packets continue being sent and re...

Continuous rapid calls to WCF service returns a " Only one usage of each socket address (protocol/network address/port) is normally permitted 127.0.0.1:10111

Hey guys. I have developed a little mashup site. This site is complete with a community. So when the user goes to the Community.aspx page he/she will see the members of the community with joined date,nuber of comments, name, etc.etc. and ofc paging as well. There are like 15 users per page. Now my problem is that i have 2 types of users ...

Who is a good host for a realtime TCP/IP game server?

I a trying to set up a real time game server that runs a game I am writing as a C# .NET 3.5 service. The game is similar to classic pong so I need to send real time feedback to both clients through a persistent socket connect to the server. This is an example of how it is coded. http://www.codeproject.com/kb/IP/socketsByBobJanova.aspx ...

What’s the easiest way to grab a web page in C ? (via https)

Almost the same question as this one here: http://stackoverflow.com/questions/825327/whats-the-easiest-way-to-grab-a-web-page-in-c however the conditions have changed and I need to connect via https, this is a bit more tricky, anyone got any snippets? I am on a qnx platform, building and compiling additional libraries and rolling it ou...

Azure: Will it work for my App?

I'm creating an application that I want to put into the cloud. This application has one main function. It hosts socket CLIENT sessions on behalf of other users (think of Beejive IM for the iPhone, where it hosts IM sessions for clients to maintain state on those IM networks, allowing the client to connect/disconnect at will, without ...

Unresolved symbols when compiling with gcc on OpenSolaris 2008.11

When compiling a simple Netbeans C project that uses sockets I get the following output. I supose the problem is that gcc is not properly linking sockets.h library. Need a foolprof method to solve this. Thanks i advance Running "/usr/bin/make -f Makefile CONF=Debug clean" in /export/home/manu/Escritorio/TP-entrega 2/Application_1 /usr...

How Can I create more than 14000 clients using HTTP (Tomcat) while HTTP works over TCP hence socket is created.

HTTP protocols work over TCP/IP. SO infact we can say if we connect a client then whether it is TCP or HTTP, a socket is created and hence a file is created. Tomcat works on HTTP. On TCP I can create 1024 clients simultaneously. If I create more clients then I get Too Many File Open Error. But Using Tomcat I can create more than 14000 c...

Threading TCP Server as proxy between connected user and unix socket.

I'm writing web application where I need to push data from server to the connected clients. This data can be send from any other script from web application. For example one user make some changes on the server and other users should be notified about that. So my idea is to use unix socket (path to socket based on user #ID) to send dat...

Where is UdpClient.CancelReceive?

I'm implementing a simple local-network discovery protocol, so I call UdpClient.Send and then UdpClient.BeginReceive. In case more than one response is pending, I call UdpClient.BeginReceive at the end of the callback. Something like this: UdpClient client = new UdpClient(AddressFamily.InterNetwork); client.EnableBroadcast = true; clien...

Socket Server Disconnect and Reconnect Buffer Error?

I'm using the following TCP Sockets Server/Client example: http://www.codeguru.com/Csharp/Csharp/cs_network/sockets/article.php/c8781/ I'm also using the following CryptoStream example: http://www.obviex.com/samples/Encryption.aspx Problem: Both Server and Clients communicate perfectly until I Stop the Server socket, wait a minute or s...

How to get a list of open sockets in Linux using C?

Hello, Is there a way to get a list of all open sockets ( socket address or socket descriptor ) in Linux using C in user-space or kernel? Thank you ...

Socket only recieveing part of message C#

I have this bit of code that is receiving a series of messages: byte[] buffer = new byte[10240]; //... sock.Receive(buffer); string response = message(buffer); Console.WriteLine("Message Recieved"); if (!verifyUser(response, sock)) Console.WriteLine("User Invalid"); //... static private bool verifyUser(string userString, Socket sock) { ...

Java Bind Exception

What would cause a TCP socket to throw "java.net.BindException: Address already in use" even when reuse address is set to true? This only occurs if the application is quickly restarted. Running on CentOS 5 linux OS. ...

Is Twisted an httplib2/socket replacement?

Many python libraries, even recently written ones, use httplib2 or the socket interface to perform networking tasks. Those are obviously easier to code on than Twisted due to their blocking nature, but I think this is a drawback when integrating them with other code, especially GUI one. If you want scalability, concurrency or GUI integr...