sockets

Fastest way to share a connection and data from it with multiple processes?

I have multiple app processes that each connect to servers and receive data from them. Often the servers being connected to and the data being retrieved overlaps between processes. So there is a lot of unnecessary duplication of the data across the network, more connections than should be necessary (which taxes the servers), and the data...

Socket communication Security issues

Are there any security issues when communicating between applications on the same machine over sockets? ...

Implementing a Handshake for a Socket Connection

I'm developing a program with a client/server model where the client logs on to the server, and the server assigns a session id/handshake which the client will use to identify/authorize its subsequent messages to the server. I'm wondering what length should the handshake be for it to be reasonably secure but also short enough to minimiz...

Avoid reusing of the same fd number in a multithread socket application

I have an asynchronous application executing several threads doing operations over sockets where operations are scheduled and then executed asynchronously. I'm trying to avoid a situation when once scheduled a read operation over a socket, the socket gets closed and reopened(by possibly another peer in another operation), before the fir...

Windows socket WSACleanup C++

Hello, I am using sockets on my program. Due to I added the WSAStatup. My application runs fine (It is always up till it gets a signal to stop). After getting the signal it stops te problem that if I write the WSAClenup function at the end of my program it crashes and if I remove it it termintes fine. Thanks ...

Setting a socket's local endpoint.

Hi, I need to create a socket which connects to a server process, but must be restricted to using a specified local adapter. The default behaviour is to use whatever it can, but I need to make sure that a given socket only tries (for example), the LAN connection, if both wifi and LAN are available. I am using C# and .NET 2.0. Cheers ...

How to unblock a thread blocked on ServerSocket.accept()?

I have a server thread with this code: public void run() { try { ServerSocket server; EneaLog.printLog("Server is running."); server = new ServerSocket(this.portnumber); while (true) { new EneaServerConnection(server.accept(), this.project,stopped).start(); if (stopped) { ...

IO::Socket timing out when getting response

I'm trying to connect to a web service using IO::Socket::INET (yes, I know that there are lots of better modules for doing this, but I don't have them and can't add them, so please don't suggest it), but I'm timing out (I think that's what it's doing) waiting for a response. Here's the basic crux of my code (I previously populate the co...

boost::asio::ip::tcp::socket is connected?

I want to verify the connection status before realize my operations (read/write). Is there a way to make an isConnect() method? I saw this, but it seems "ugly". I tested is_open() function also, but doesn't have the expected behavior. Thanks ...

JVM crash on opening a "return" SocketChannel

Hi Was working my ... off on a handin project this evening, and suddenly the JVM started crashing on me. I've been able to create a simple program that can reproduce the crash, and have submitted it to Sun, but I wondered if anyone in here could take a look at the program, and tell me if I'm doing something stupid (ie there's an easy wa...

Non Blocking Server in Python

Hi, Can someone please tell how to write a Non-Blocking server code using the socket library alone.Thanks ...

UDP socket port allocation failure

Hi I am creating a winsock UDP program. code i am using is shown below. I am always getting port assignment error. I am not able to understand why port always allocated is zero. If some can help me with this.... void UDPecho(const char *, const char *); void errexit(const char *, ...); #define LINELEN 128 #define WSVERS MAKEWORD(...

Closing sockets in python

I'm modifying Python code that have this form: def foo(self): try: connect socket except Exception, e: some error reporting stuff return an error use the socket do some other stuff if some condition: return do some more stuff socket.close() return normally Coming from ...

Multiple Sockets on the same port vs Multiple Sockets on multiple ports

Let me explain my scenario before asking the question. I am in creation phase of 17 different multiplayer games that can be played online, directly from browser. To accomplish this, I have choosed Silverlight. Communication will be done using Sockets. Image 17 different type of games like Chess, Backgammon, Pool and hundred of online use...

Actionscript TCP Socket failing to send message for some people

I've written a socket server which communicates with my actionscript 3 flash game using the Socket class. This is a TCP connection, which I thought would mean that it is 100% sure that the sending message will be received by the server as this is done low-level. So, if it would fail to send it would resend the message. This does seem to...

Python Fixed Length Packet

I am trying to build a fixed length packet in python for an ATSC PSIP generator. This is probably very simple but so far I can't seem to get it to work. I am trying to build a packet with fields similar to the following: table_id = 0xCB syntax = 0b1 reserved = 0b11 table_ext = 0xFF the end goal would be the following in binary '110...

Safari4 HTML5 Socket support

I've heard that the new HTML5 will support open sockets, does anyone know if it's currently supported in safari4, I'm particularly interested in getting sockets to work through the safari browser of an iphone. Thanks in advance, Josh ...

Does Creating a New Thread Duplicate File Descriptors and Socket Descriptors in Linux?

Everyone knows the classic model of a process listening for connections on a socket and forking a new process to handle each new connection. Normal practice is for the parent process to immediately call close on the newly created socket, decrementing the handle count so that only the child has a handle to the new socket. I've read that...

c++ winsock2, how to tell when a connection closes

I have a c++ program using winsock2. I would like to know how to tell when someone's connection to my program closes. ...

How to handle same socket in different threads?

I am trying to handle socket in different threads creating runtime failure. See following code. void MySocket::Lock() { m_LockCount++; if( m_LockCount ) { CSocket::Create( 8080 ); } } void MySocket::Unlock() { m_LockCount--; if( !m_LockCount ) { CSocket::Close(); } } I am calling Lock() fro...