sockets

Non-blocking Socket Polling vs Blocking socket

I need to Send & Recv at the same time, which should be the best: 1 thread handling send & recv with non-blocking socket or 2 threads with One handling blocking recv() + one handling send() Or is there another option? I am expecting to have up to about 50 2 way connections.. Which result in 50 thread in option1, and 100 thread in opt...

What types of apps are developed today using socket programming?

I've worked in business application development for a while but have never done socket programming. I know that all HTTP transport implicitly involves socket communication but this is all abstracted when using most software frameworks. So I was curious what types of apps developed today involve socket programming? ...

Reconnect a Java socket connection on disconnect

I've got Java code which makes a long term socket connection to a home automation device to monitor it for activity/events. The problem is if the device is rebooted or gets power cycled the Java code should automatically reconnect as soon as possible. Any ideas for how to detect a dropped connection on the Java side, preferably without...

Java sockets - asynchronous wait, synchronous read

I want to be able to asynchronously wait on socket, then synchronously read from it: for (;;) { while (data available on socket) { read message from socket; process it; } do something else; } (I need this because I want to poll a queue with messages from GUI at the same time, so the "do something else...

Is it safe to use Socket.LocalEndPoint as a unique id?

Hello; When a server accepts a client over a tcp/ip connection, a new socket is created. Is it safe to use the LocalEndPoint port (from the client perspective) as an id? Example (from the server perspective): int clientId = ((IPEndPoint)client.RemoteEndPoint).Port; On my local machine, the port seems to be unique, but with multiple cl...

Identical Error Codes

I use python 2.4.1 on Linux, and a python package written inside the company I work in, for establishing a connection between 2 hosts for test purposes. Upon establishing the connection the side defined as the client side failed when calling socket.connect with the correct parameters (I checked) with the error code 111. After searching ...

testing ipv6 applications

Hi All, I have a network application that I need to convert so that it works for ipv6 network. Could you please let me know what I need to do (replace socket APIs)? One more thing, how can I test my application? Thanks. ...

Do I need to register ports as "in-use" with ICANN?

The application I'm currently working on requires three ports to be opened. At the moment these are 5024 through 5026 but on reading around I discovered that these lie in the ICANN registered range (i.e. ports < 49151). Is there any need for me to inform any organisation that I plan to use these ports if it's within a local network only...

Are message queues obsolete in linux?

I've been playing with message queues (System V, but POSIX should be ok too) in Linux recently and they seem perfect for my application, but after reading The Art of Unix Programming I'm not sure if they are really a good choice. http://www.faqs.org/docs/artu/ch07s02.html#id2922148 The upper, message-passing layer of System V IPC ha...

Socket : can an asynchronous Receive returns without reading all the bytes I asked for?

Hi; I was reading an article on Vadym Stetsiak's blog about how to transfer variable length messages with async sockets (url: http://vadmyst.blogspot.com/2008/03/part-2-how-to-transfer-fixed-sized-data.html). He says : What to expect when multiple messages arrive at the server? While dealing with multiple messages one has to reme...

How Create a .NET HttpWebRequest class from a Socket's recieved byte[]'s

Hi all, I have a socket that is receiving HTTP requests. So I have a raw http request in byte[] form from my socket. I have to study this request - BUT Instead of reinventing the wheel - can I 'cast' this byte array into a System.Net.HttpWebRequest or something similar? Thanks! ----- UPDATE --------- So anyway I couldn't find the ...

How to set the don't fragment (DF) flag on a socket?

I am trying to set the DF (don't fragment flag) for sending packets using UDP. Looking at the Richard Steven's book Volume 1 Unix Network Programming; The Sockets Networking API, I am unable to find how to set this. I suspect that I would do it with setsockopt() but can't find it in the table on page 193. Please suggest how this is do...

Socket Recommendations

Hi, I'm doing a little research in developing a simple socket server that will run as a windows service. I'm going to write this in C#, but I've been made aware that .Net sockets are slllooooowwwww. For the initial roll out using the .Net Networking classes will be fine, but I'm wondering if anyone has experience with a high performanc...

Server side for a multiplayer turn based silverlight game.

I am currently in the early stages of designing a browser based game using silverlight. The game is going to have many matches of 2-4 players (perhaps even up to 8) and will be turn based. The Front end is Silverlight 3.0 since I have some experience there. I am trying to figure out what the back end should be. Since the game is turn b...

Send output from a python server back to client

Hello, I now have a small java script server working correctly, called by: <?php $handle = fsockopen("udp://78.129.148.16",12345); fwrite($handle,"vzctlrestart110"); fclose($handle); ?> On a remote server the following python server is running and executing the comand's #!/usr/bin/python import os import socket print " Loadin...

java/groovy socket write timeout

I have a simple badly behaved server (written in Groovy) ServerSocket ss = new ServerSocket(8889); Socket s = ss.accept() Thread.sleep(1000000) And a client who I want to have timeout (since the server is not consuming it's input) Socket s = new Socket("192.168.0.106", 8889) s.setSoTimeout(100); s.getOutputStream.write( new byte[100...

PHP Socket define the max time to wait

$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_bind($socket, $ip_server , $port); socket_sendto($socket, $ascii_egyben_kimenet, strlen($ascii_egyben_kimenet), 0, $ip_plc , $port); $valasz_kimenet=socket_read($socket, 256); Because the socket_read the server is waiting for an answer... How I can define the max time to wa...

UNIX Domain Sockets and Cocoa

I want to implement IPC in a Cocoa application using UNIX domain sockets, with which I have no experience. I found Apple's CFLocalServer example project, but it's written in C and looks, well, fairly complicated (and yes, I have read most of it). Are the techniques demonstrated in CFLocalServer still state-of-the-art, or is there a way...

How to ignore certain socket requests.

Hello, I'm currently working on a TCP socket server in C++; and I'm trying to figure out how I can ignore all browser connections made to my server. Any idea's? Thanks. ...

Javascript TCP connection to server

Hey folks, I have created server daemon, that produces some data, like messages and so. But, what im interested in - client monitoring. For example i have web page, and i need to establish persistent Tcp connection to server and show all incoming data into textbox. I know it can be done with flash, but im searching for JS implementation...