sockets

supporting persistent HTTP connections in my proxy server

Hi all, I am implementing a HTTP caching proxy server in C++.I am done with most part of it but i am stuck at a point. What i am doing is creating each thread with a socket to handle each time a request from browser comes. I parse the request, check for its availability in cache and if not found forward it to end www server.In both cases...

Java Network Programming. Question about sockets

I have a server and has 2 clients connecting to it through TCP. These clients continuously send information to the server. This is a proxy server and relays the messages it receives from the client. But it has to do relay the messages alternately. i.e. message from client A, then message from client B and again A then B and so on. This I...

Simple socket server that can send raw messsages that I type in?

Hi, Does a simple socket server exists that sends any message I want to send to all clients? I need to do this to test a socket client. And FAFAIK Putty can't do this. Thanks, Myth ...

What would you use to implement a fast and lightweight file server?

I need to have as part of a desktop application a file server which should respond as fast as possible to file transfer requests (from remote clients, usually located on the same LAN). There will be many file requests for small sized files. The server should be able to provide both upload and download services. I am not tight to any par...

Is there a limit on number of tcp/ip connections between machines on linux?

I have a very simple program written in 5 min that opens a sever socket and loops through the request and prints to the screen the bytes sent to it. I then tried to benchmark how many connections I can hammer it with to try to find out how many concurrent users I can support with this program. On another machine (where the network bet...

How to create a lot (I mean a lot) of sockets in Linux?

I have tried to create a simple program in different languages (C#, Java, C++, PHP) to connect to a server and all behaved in the same way. So I believe this problem is more of a OS level thing. Basically I want the program to connect to the server with a TCP socket and send 1 byte and then close the socket. This needs to done thousands...

Why am I getting an error when I try to run my socket program in Java?

I'm using jcreatorLE and JDK 1.6 to run my program. I don't know why I get an error when I try to run. Could somebody explain the reason to me? This is the code for the Server: import java.io.*; import java.net.*; class ServidorTCP { // variable to wait for connections private static ServerSocket servidor = null; // Variable...

C#: How to deal with out-of-order TCP packets?

Can please someone one explain how to deal with out-of-order packets. I'm using raw socket to capture packets, and parse them as they come, but some of them come in wrong order, for example: Id...........Flags 16390 : (PSH, ACK) 16535 : (PSH, ACK) 16638 : (ACK) 16640 : (PSH, ACK) 16639 : (ACK) 16695 : (PSH, ACK) Packets with IDs: ...

How to convert IntPtr/Int to Socket?

Hello, I want to convert message.WParam to Socket. protected override void WndProc(ref Message m) { if (m.Msg == Values.MESSAGE_ASYNC) { switch (m.LParam.ToInt32()) { case Values.FD_READ: WS2.Receive(m.WParam); case Values.FD_WRITE: bre...

Examples of Java I/O Stream Filters

I am looking for example code that demonstrates how to create a filter that understands binary data. Links to examples are greatly appreciated. ...

How do I close a port in a case of program termination?

I am using Socket communication in one of my Java applications.As I know if the program meets any abnormal termination the listening ports does not get closed and the program cannot be started back because it reports "Port already open.." Do I have anyway to handle this problem? What is the general way used to handle this matter? ...

How do I obtain the latency between server and client in C#

I'm working on a C# Server application for a game engine I'm writing in ActionScript 3. I'm using an authoritative server model as to prevent cheating and ensure fair game. So far, everything works well: When the client begins moving, it tells the server and starts rendering locally; the server, then, tells everyone else that client X ...

How to avoid Socket.EndReceive()blocking when no data is available

I am using the BeginReceive() and EndReceive() method for async IO using Sockets in .NET. The client sends continuous packets of data and calling EndReceive() returns the number of bytes read. The problem is that the client is sending packets of data but data length is ZERO. It found this by analyzing the traffic in WireShark. When the ...

(Python) socket.gaierror: [Errno 11001] getaddrinfo failed

I'm not sure whats wrong with this code I keep getting that socket.gaierror error ;\ . import sys import socket import random filename = "whoiservers.txt" server_name = random.choice(list(open(filename))) print "connecting to %s..." % server_name s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((server_name, 43)) s.se...

Python +sockets

Hello, i have to create connecting server<=>client. I use this code: Server: import socket HOST = 'localhost' PORT = 50007 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() print 'Connected by', addr while 1: data = conn.recv(1024) if not data: break conn.se...

Server vs Client Socket (Low level details)???

General Programming: In a server socket accept() method what exactly happens. At low level how server sockets are different from client sockets? ...

.NET project for TCP messaging

Is there an open source project or framework in .NET which provides the basic "plumbing" for messaging between client(s) and server over TCP? It seems like one of those things where I end up writing essentially the same thing over and over, and I'd like to abstract myself away from that a little bit more and deal with the particulars of ...

Multiple simultaneous network connections - Telnet server, Python.

I'm currently writing a telnet server in Python. It's a content server. People would connect to the server via telnet, and be presented with text-only content. My problem is that the server would obviously need to support more than one simultaneous connection. The current implementation I have now supports only one. This is the basic,...

socket programming in Java

I want to run a client/server application that is built in Java using socket connection. If I run both the server and the client program in same machine, the client and server communicate each other as expected. But on the other hand, if run the client program on some other system, I get an exception java.net.ConnectException: Connectio...

How can I simulate a socket disconnection (on windows) between a client and a server?

I've implemented a kind of 'heartbeat solution' and I'd like to see what happen when the network 'goes down', in real conditions, specially if it happens when there is no traffic on the socket. Problems: - I've got only one computer; - I'm on windows/java; I guess that simply unplugging the network cable/deactivating the network card ...