sockets

What possible uses would multicast support have in a Java trading system?

I've been asked to look into adding multicast support to a Java trading system but, to be honest, I don't have the slightest clue what this could be for. Would this mainly be to allow the trading system to broadcast trade messages to different types of clients, say, a mobile phone as well as a server? Why might a trading system need mult...

how to get ip address from sock structure in c ?

I'm writing simple server/client and trying to get client ip address and save it on server side to decide which client should get into critical section. I googled it several times but couldn't find proper way to get ip address from sock structure. I believe this is a way to get ip from sock struct after server accept request from client...

Setting the source IP for a UDP socket

I have a UDP socket that is bound to INADDR_ANY to listen to packets on all the IPs my server has. I'm sending out replies through the same socket. Right now the server chooses automatically which IP is used as the source IP when packets are sent out, but I would like to be able to set the outgoing source IP myself. Is there any way to...

How do I cleanly reconnect a boost::socket following a disconnect?

My client application uses a boost::asio::ip::tcp::socket to connect to a remote server. If the app loses connection to this server (e.g. due to the server crashing or being shutdown) I would like it to attempt a re-connect at regular intervals until it succeeds. What do I need to do on the client-side to cleanly handle a disconnect, ti...

I am getting an exception when my tcp client connects to the server with ip address but works with "localhost"

I am writing a simple C# tcp client and server program. The server will eventually be on a different machine but now I am just testing on the same machine. I am getting an exception error "Only one usage of each socket address (protocol/network address/port) is normally permitted" when I create my TcpClient using the ip address. But it...

ReceiveFromAsync Example

Hi Does any one have an example for ReceiveFromAsync works with regard to UDP? i couldn't find any sample code. I can find a few TCP sample but msdn say 'The ReceiveFromAsync method is used primarily to receive data on a connectionless socket'. Thanks, Nick ...

How to use CFNetwork to get byte array from sockets?

Hi, I'm working in a project for the iPad, it is a small program and I need it to communicate with another software that runs on windows and act like a server; so the application that I'm creating for the iPad will be the client. I'm using CFNetwork to do sockets communication, this is the way I'm establishing the connection: char ip[...

.NET Remoting: Getting underlying socket?

Hi, I'm writing a light remoting app to assist in debugging a problem with remoting communication. This app mimics much of what a larger application does: Periodically sends a heartbeat to another peer application, and periodically verifies that a heartbeat has been received within some time threshold. What we're seeing is...

StreamReader.EndOfStream produces IOException

I'm working on an application that accepts TCP connections and reads in data until an </File> marker is read and then writes that data to the filesystem. I don't want to disconnect, I want to let the client sending the data to do that so they can send multiple files in one connection. I'm using the StreamReader.EndOfStream around my out...

how to make a non-blockin recv from perl socket

I make a recv call on a TCP socket and it tured out to be that the recv call is a blocking one even though the socket itself has set to be in non-blocking mode. So my question is just as simple as: how to implement a non-blocking recv on a perl socket? thanks in advance. ...

PHP Sockets Not Working

Hi, I switched from Lighttpd server to WAMP and then found sockets in php are not working. But php is configured and working. (phpinfo() works) I removed the comment for the php_sockets.dll in php.ini @ C:\wamp\bin\php\php5.2.5.but still gives the error "Fatal error: Call to undefined function socket_create()". Any more configurations t...

Silverlight Socket Constantly Returns With Empty Buffer

I am using Silverlight to interact with a proxy application that I have developed but, without the proxy sending a message to the Silverlight application, it executes the receive completed handler with an empty buffer ('\0's). Is there something I'm doing wrong? It is causing a major memory leak. this._rawBuffer = new Byte[this.BUFFER...

Creating TCP network errors for unit testing

I'd like to create various network errors during testing. I'm using the Berkely sockets API directly in C++ on Linux. I'm running a mock server in another thread from within Boost.Test which listens on localhost. For instance, I'd like to create a timeout during connect. So far I've tried not calling accept in my mock server and sett...

java.net.SocketException: Connection reset

Hello need some help! I´m trying to implement a socket connection, and my client shows the folowing: mySocketClient: IOException: java.net.SocketException: Connection reset java.net.SocketInputStream.read(Unknown Source) java.net.SocketInputStream.read(Unknown Source) java.io.DataInputStream.readShort(Unknown Source) mySocketClient.con...

reading partially from sockets

I'm having a little test program that sends a lot of udp packets between client->server->client (ping/pong test). The packets are fixed size on each run(last run is max allowable size of udp packet) I'm filling the packets with random data except for the beginning of each packet that contains the packet number. So I'm only interested to ...

What is the difference between connection and read timeout for sockets?

3 questions: 1) What is the difference between connection and read timeout for sockets? 2) What does connection timeout set to "infinity" mean? In what situation can it remain in an infinitive loop? and what can trigger that the infinity-loop dies? 3) What does read timeout set to "infinity" mean? In what situation can it remain in an...

Will EAGAIN return on send for anything other than buffer full?

If I use send() on a non-blocking tcp socket in Linux will it return EAGAIN for anything other than a send buffer full condition? I basically need to decide if I want to use the socket send buffer as the only buffer for my app or if I need my own user space buffer to feed the socket buffer. ...

PHP http_get vs fsockopen to HTTPS server?

In PHP, what are the biggest considerations when choosing between using http_get("https://...") and a sockets loop with fsockopen("ssl://..."), fputs() and fread()? I’ve seen a couple of implementations lately that use the latter. Is that just old legacy code or is there some good reason for it? Thanks. ...

Why a DataCallBack method listen in the background is not being invoked?

Hi, I've been working with CFNetwork to create a client application for iPad, it is a small application, nothing fancy. This is how I create the connection to the server (running in windows). - (void) startConnection { char ip[] = "192.168.0.244"; NSString *ipAddress = [[NSString alloc] initWithCString:ip]; /* Build our s...

Interfacing socket code with a Linux PCI driver

I have two devices that are interfaced with PCI. I also have code for both devices that uses generic socket code. (The devices were originally connected by MII/Ethernet.) Now, I need to write a PCI device driver to transport packets back and forth between the two devices. How do I access the file descriptors opened by the socket co...