sockets

How to use the C socket API in C++ on z/OS

I've been having issues getting the C sockets API to work properly in C++. Specifically, although I am including sys/socket.h, I still get compile time errors telling me that AF_INET is not defined. Am I missing something obvious, or could this be related to the fact that I'm doing this coding on z/OS and my problems are much more compli...

Asynchronous multi-direction server-client communication over the same open socket?

I have a client-server app where the client is on a Windows Wobile 6 device, written in C++ and the server is on full Windows and written in C#. Originally, I only needed it to send messages from the client to the server, with the server only ever sending back an acknowledgment that it received the message. Now, I would like to update i...

Reverse DNS in Ruby?

I'm in an environment with a lot of computers that haven't been properly inventoried. Basically, no one knows which IP goes with which mac address and which hostname. So I wrote the following: # This script goes down the entire IP range and attempts to# retrieve the Hostname and mac address and outputs them# into a file. Yay!require "so...

ActionScript 3.0 sockets can't reconnect

I'm having trouble connecting (via the Socket and XMLSocket classes) to a TCP listener after a connect timeout. I have a flash applet that needs to maintain a TCP connection to a server. I have implemented timeouts using Timers, a ping-pong system, etc. However, there's a problem. Upon calling Socket.connect(), the flash player (9.0.115...

How can I determine the IP of my router/gateway in Java?

How can I determine the IP of my router/gateway in Java? I can get my IP easily enough. I can get my internet IP using a service on a website. But how can I determine my gateway's IP? This is somewhat easy in .NET if you know your way around. But how do you do it in Java? ...

Firefox plugin - sockets

I've always wanted a way to make a socket connection to a server and allow the server to manipulate the page DOM. For example, this could be used in a stock quotes page, so the server can push new quotes as they become available. I know this is a classic limitation (feature?) of HTTP's request/response protocol, but I think this coul...

Sockets in Pascal

How do you use network sockets in Pascal? ...

Configure a Java Socket to fail-fast on disconnect?

Hi, I have a listening port on my server that I'm connecting to using a Java class and the Socket interface, i.e. Socket mySocket = new Socket(host,port); I then grab an OutputStream, decorate with a PrintWriter in autoflush mode and I'm laughing - except if the listening port closes. Then I get tcp4 0 0 *.9999 ...

Maximum buffer length for sendto?

How do you get the maximum number of bytes that can be passed to a sendto(..) call for a socket opened as a UDP port? ...

Reconnect logic with connectivity notifications

Say I have an application that wants a persistant connection to a server. How do I implement connection/reconnection logic so that I'm not wasting resources (power/bandwidth) and I have fast reconnect time when connectivity appears/improves? If I only use connectivity notifications, I can get stuck on problems not related to the local ne...

Free Network Monitor

I am having trouble integrating two products, one of which is mine and they appear not to be talking. So I want to make sure they are communicating correctly. I had a look around for network monitor and found TCP Spy. This works but only shows 1 side of the conversation at a time (it has to run locally) I would ideally like to see both s...

How to get your own (local) IP-Address from an udp-socket (C/C++)

You have multiple network adapters. Bind a UDP socket to an local port, without specifying an address. Receive packets on one of the adapters. How do you get the local ip address of the adapter which received the packet? The question is, "What is the ip address from the receiver adapter?" not the address from the sender which we get ...

C# Performance For Proxy Server (vs C++)

I want to create a simple http proxy server that does some very basic processing on the http headers (i.e. if header x == y, do z). The server may need to support hundreds of users. I can write the server in C# (pretty easy) or c++ (much harder). However, would a C# version have as good of performance as a C++ version? If not, would ...

WSACancelBlockingCall exception

Ok, I have a strange exception thrown from my code that's been bothering me for ages. System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall at System.Net.Sockets.Socket.Accept() at System.Net.Sockets.TcpListener.AcceptTcpClient() MSDN isn't terribly helpfull on this : http://...

How do you minimize the number of threads used in a tcp server application?

I am looking for any strategies people use when implementing server applications that service client TCP (or UDP) requests: design patterns, implementation techniques, best practices, etc. Let's assume for the purposes of this question that the requests are relatively long-lived (several minutes) and that the traffic is time sensitive, ...

What's the idiomatic way to do async socket programming in Delphi?

What is the normal way people writing network code in Delphi use Windows-style overlapped asynchronous socket I/O? Here's my prior research into this question: The Indy components seem entirely synchronous. On the other hand, while ScktComp unit does use WSAAsyncSelect, it basically only asynchronizes a BSD-style multiplexed socket app...

How do I make persistent network sockets on Unix in Ruby?

I'd like to be able to write a ruby program that can restart without dropping it's socket connections. ...

How to forcibly close a socket in TIME_WAIT?

I run a particular program on linux which sometimes crashes. If you open it quickly after that, it listens on socket 49201 instead of 49200 as it did the first time. netstat reveals that 49200 is in a TIME_WAIT state. Is there a program you can run to immediately force that socket move out of the TIME_WAIT state? ...

Stream data (such as music) using PHP (or another language)

For years, I've been investigating how to create music streams from my computer. I've seen programs, but anything useful I've seen is windows only (I use a Mac). Eventually, I got interested in how streams work. Is there any way I could create my own stream, possibly using socket functions in PHP? Is there a PHP library for this? Th...

Sockets and Processes in Java

In Java, what would the best way be to have a constantly listening port open, and still send upon receipt of a packet. I'm not particularly savvy with network programming at the moment, so the tutorials I've found on the net aren't particularly helpful. Would it make sense to have the listening socket as a serversocket and run it in a s...