sockets

How can I work around WinXP using ports 1025-5000 as ephemeral?

If you create a TCP client socket with port 0 instead of a non-zero port, then the operating system chooses any free ephemeral port for you. Most OSes choose ephemeral ports from the IANA dynamic port range of 49152-65535. However in Windows Server 2003 and earlier (including XP) Microsoft used ports 1025-5000 as the ephemeral range, a...

exiting from a blocking select call!

I am calling a third party API which creates a socket, does a connect and then calls select API by passing the socket to block forever. I don't have access to the socket. Is there some way in which I can make the select call come out from my application without having access to the socket? My platform is Windows. ...

Python and C++ Sockets converting packet data

First of all, to clarify my goal: There exist two programs written in C in our laboratory. I am working on a Proxy Server (bidirectional) for them (which will also mainpulate the data). And I want to write that proxy server in Python. It is important to know that I know close to nothing about these two programs, I only know the definitio...

What is faster: multiple `send`s or using buffering?

I'm playing around with sockets in C/Python and I wonder what is the most efficient way to send headers from a Python dictionary to the client socket. My ideas: use a send call for every header. Pros: No memory allocation needed. Cons: many send calls -- probably error prone; error management should be rather complicated use a buffer....

Windows Mobile 6 - .net Socket advice [Compact Framework 3.5]

Hi, I'm trying to open a socket that will receive all packets sent to the Windows Mobile Device over the Active Sync network. I'm using code from: CS Network Sniffer for Windows Specifically: //For sniffing the socket to capture the packets has to be a raw socket, with the //address family being of typ...

Question regarding TCP Connection Forcefully shut down.

Hi All, I am designing a Client Server Chat application in Java which uses TCP connection between them. I am not able to figure out how to detect at server side when a client forcefully closes down. I need this as i am maintaining a list of online clients and i need to remove user from the list when he forcefully closes the connection. ...

in socket programming, can accept() the same listening socket in multi-process(thread)?

i.e. open a listening socket in parent process call epoll_wait(listening_socket) in child1,child2,child3.... call accept in each child if there is connection request ...

what is more secure -- Data transfer using socket programming OR SSH/SCP/FTP

I am still learning socket programming (using Perl) but I have both options ( socket programming and SSH/SCP/FTP) available to transfer the data from remote machines to my local servers. But I have to select one which is more secure ( encrypted data on network) in terms of data transfer. Any suggestions. ...

Poll SelectMode.Read throws WouldBlock all the time on client

I have another tricky situation with my socket experience. I'm writing a non-blocking server/client for some key-value data storage. Here's the situation: connect to server post data to it (wait for no confirmation that data's being submited) right after then (staying on the same connected socket) I'm trying to read that data Here's...

Python, implementing proxy support for a socket based application (not urllib2)

Hey guys, I am little stumped: I have a simple messenger client program (pure python, sockets), and I wanted to add proxy support (http/s, socks), however I am a little confused on how to go about it. I am assuming that the connection on the socket level will be done to the proxy server, at which point the headers should contain a CONNE...

rpcbind authorization problems

Hy, I am using rpcbind (SunRPC) on Arch linux and python rpc.py (wich use standard python socket module) interface for comunication with it, but every time I try to send request for registration or unregistration to rpcbind I get message that I am rejected for security reasons. Only situation when everything works is that when I call rp...

Is it possible to suppress loopback of broadcasted packets?

Hello guys, I have a .NET program that "listens" and broadcasts on the same port. So, when it broadcasts packets, these packets loop back to my program, and I wish it didn't happen. Is there a way to block broadcast loopback? ...

Hide cursor on remote terminal

I have an open socket to a remote terminal. Using the answer to "Force telnet client into character mode" I was able to put that terminal into character mode. My question is, how do I hide the cursor in the remote terminal using this method? ...

How to know when to close socket when dealing with HTTP clients?

Hi, How can I know when to close the socket of an HTTP client (I mean a browser is connecting to my TCP socket server). Everything works perfect but in other for the browser to show what the server has sent, i have to shutdown the server (or call socket.Close()). It works fine if I call (socket.Close()) but I just don't know when.? I ...

send keystrokes from iphone to PC

hi guys. I'm looking to create a simple app which will send keystrokes from an iphone to a PC. I understand that I will need to have a program on my PC "listening"... I've been looking in to AsyncSocket and NSStream, but there are no tutorials which really make it clear to understand. Does anyone know if this is right? I basically wa...

How long will NetworkStream Read wait, before dying?

I have a call to Read on NetworkStream objeck, which uses Socket.Receive internally. Say that no data is comming in. How long before the Read Method exits? ReceiveTimeout is set to 0 (infinite timeout). What if I unplug the internet cable? Will it exit? ...

Limit Connections with semaphores

I'm trying to limit the number of connections my server will accept using semaphores, but when running, my code doesn't seem to make this restriction - am I using the semaphore correctly? eg. I have hardcoded the number of permit as 2, but I can connect an unlimited number of clients... public class EServer implements Runnable { pri...

Crossdomain xml and flash

Hello, I have a web server application (based on python). Flash applications which are located at this server should connect to the server. The trouble is in crossdomain.xml. <?xml version="1.0"?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"&gt; <cross-domain-policy> <allow-access-from do...

Reading off a socket until end of line C#?

I'm trying to write a service that listens to a TCP Socket on a given port until an end of line is recived and then based on the "line" that was received executes a command. I've followed a basic socket programming tutorial for c# and have come up with the following code to listen to a socket: public void StartListening() { ...

general socket question

Hi guys I'm building a client that "talks" to the http server. Now my client needs to download files simultaneously. Right now my client just opens a socket (actually Async Socket) for every connection, but I was wondering whether I could do that with just one socket? Thanks Alex ...