sockets

.Net Server Clustering Techniques

I want to develop a multi-server clustered framework that will work similarly to the steps below for message flow. From Client Gateway Server Recieves Message Gateway Server sends an ACK Message (UDP) Message is custom deserialized from binary into an object via a factory Message is then routed to a secondary server in the cluster (co...

Why does gethostbyaddr(gethostname()) return my IPv6 IP?

I'm working on making a simple server application with python, and I'm trying to get the IP to bind the listening socket to. An example I looked at uses this: HOST = gethostbyaddr(gethostname()) With a little more processing after this, it should give me just the host IP as a string. This should return the IPv4 address. But when I ru...

C# Sockets: How do you handle a socket in C#.NET the way they're handled in VB6 or Delphi (event driven)?

C# Sockets: How do you handle a socket in C#.NET the way they're handled in VB6 or Delphi (event driven)? On VB6 or Delphi, when creating a socket, you had an onconnect, onreceive, and onerror events placed into the main code file, how would I replicate the same? ...

Vista Parental Controls causing Socket Exception?

I got a strange bug report the other day and was hoping someone might be able to help me figure out the culprit. I've got a plug-in that uses the Facebook API to make calls from a desktop client program. A user reports that when he turns on Vista's Parental Controls, he gets a run-time exception. The detailed bug report is available her...

C# socket abnormal latency

Hi, I am working on a little online multiplayer pong game with C# and XNA. I use sockets to transfer data between two computers on my personnal LAN. It works fine. The issue is with speed : the transfer is slow. When I ping the second computer, it shows a latency of 2 ms. I set up a little timer inside my code, and it shows a latency ...

Problem disposing of socket / finalising twice?

I'm working with some code (not mine I hasten to add, I don't trust this much at all) for a class which opens a socket, makes requests and listens for responses, which is throwing an exception in a way I can't comprehend when tested in xunit. I assume the same exception happens "live" but the class is referenced by a singleton so it is p...

Unable to run junit tests in Eclipse

I and my colleagues have an intermittent problem running junit tests or tomcat from within Eclipse. Sometimes the tests will run. Sometimes they will not. There appears to be no pattern and we are not in sync. IE mine might run and others will fail. Stopping/starting Eclipse can resolve the issue (sometimes). Pulling out the network ca...

Reading from 2 sockets in 2 threads causes data loss

I have a multi-threaded Windows C++ app written in Visual Studio 6. Within the app 2 threads are running each trying to read UDP packets on different ports. If I protect the reading from the socket with a critical section then all the date read is fine. Without that protection data is lost from both sockets. Is reading from a socket ...

A machine has 2 NICs. Which will be utilized when connecting to a socket?

Suppose I create a very simple socket connection, how can one programatically: Find out what interface (ip address / NIC) is being used. Force the other interface ...

Is there a file descriptor leak when using sockets on a linux platform?

If I open and close a socket by calling for instance Socket s = new Socket( ... ); s.setReuseAddress(true); in = s.getInputStream(); ... in.close(); s.close(); Linux states that this socket is still open or at least the file descriptor for the connection is presen. When querying the open files for this process by lsof, there is an en...

connecting between two separate socket connections..

I wrote a c# app that listens to port 8000 and 8001. There are two different applications that connects to 8000 and 8001. I have used socket arrays so that any number of connections are accepted. Will I be able to some how attach one 8000 connection and 8001 connection in such a way that what ever data send by the application connecte...

C, HTTP 1.1 and Socket Send troubles

As an addition to my previous post on Creating a web server in pure C, I'm having some trouble with the Sending function. Here's two code snippets: int Send(char *message) { int length, bytes_sent; length = strlen(message); bytes_sent = send(connecting_socket, message, length, 0); return bytes_sent; } ...

POSIX cancellation points

Can anyone point me towards a definitive list of POSIX cancellation points? I was just about to answer a question on stackoverflow and realised I didn't know my stuff well enough! In particular, are accept() and select() cancellation points? I have an old book that says no, but I've seen sites on the internet claim that they are. Con...

Sockets: Discover port availability using Java

How to programmatically find availability of a port in a given machine using java?i.e given a port number whther it is already being used . ...

Get info for Common Log Format from socket in C

I want to create a log file for my webserver written in C under UNIX. The logfile should be formatted according to Common Log Format, but I don't know how to get the ident and authuser from the connecting socket. Is there a simple way to get these from the socket? ...

Socket programming with C#

I'm building a client/server application to make periodic backups of certain files. Basically, the client will monitor certain files for changes, and upload them to the server. The server will then receive them and will save them with an incrementing postfix.(i.e. "filename_v1", "filename_v2", etc). Now, I managed to get most of it done,...

C# SocketException with Multicast on XP

The following C# code works correctly on Vista, but fails on XP with: SocketException: An invalid argument was supplied. The ErrorCode is 10022. The firewall on XP has been disabled. using System; using System.Net; using System.Net.Sockets; public class SocketTest { [STAThread] public static void Main() { MySocke...

Send broadcast message from all network adapters

I have an application that sends broadcast messages and listens for response packets. Below is the code snippet. m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); m_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); m_socket.Bind(new IPEndPoint(IPAddress.Any, 2000)); ...

How are sockets implemented in JVM?

Hi folks! I want to know, how sockets are implemented in the Java Virtual Machine. Is there a native library included? And if, is it a C library? Where can I find information about this topic? The offical Java tutorial on networking does not help me there. Some interesting links would help. Update: Are there any official informati...

What happens to sockets when I unplug a network cable?

I have three applications that talk to each other using sockets. They can all live on their own machines but they can also share a machine. Right now I'm having two of them on the same and the third on its own machine. I'm trying to make my communication bullet proof so I unplug cables and kill the applications to make sure everything wo...