tcp

Checking IP Port State Remotely

I found an article on getting active tcp/udp connections on a machine. http://www.codeproject.com/KB/IP/iphlpapi.aspx My issue however is I need to be able to determine active connections remotely - to see if a particular port is running or listening without tampering with the machine. Is this possible? Doesn't seem like it natively,...

Need to run a TCP server besides a Rails app

Hi, I have a Rails 2.0.2 application running with a postgresql db. The machine will receive data on a TCP port. I already have coded a working ruby multithreaded tcp server to receive the requests, but I need this code to run alongside my Rails app. So I guess I need to know how to span a new process inside Rails, or how to create a wo...

How should one go about choosing a default TCP/IP port for a new service?

When developing an app that will listen on a TCP/IP port, how should one go about selecting a default port? Assume that this app will be installed on many computers, and that avoiding port conflicts is desired. ...

Find the next TCP port in .Net

I want to create a new net.tcp://localhost:x/Service endpoint for a WCF service call, with a dynamically assigned new open tcp port. I know that TcpClient will assign a new client side port when I open a connection to a given server. Is there a simple way to find the next open TCP port in .Net? I need the actual number, so that I can ...

Exceptions vs Result Codes for a socket client class.

Hello, I have a class that encapsulates tcp socket communications with a server. For each command message sent to the server, the server will send back a response message that invariably contains a response code (OK, Fail). Using my class, each command can be executed either sync or async. There are basically two types of exceptions tha...

Java: How do detect a remote side socket close?

How do you detect if Socket#close() has been called on a socket on the remote side? ...

Why is it impossible, without attempting I/O, to detect that TCP socket was gracefully closed by peer?

As a follow up to a recent question (http://stackoverflow.com/questions/151590/java-how-do-detect-a-remote-side-socket-close), I wonder why it is impossible in Java, without attempting reading/writing on a TCP socket, to detect that the socket has been gracefully closed by the peer? This seems to be the case regardless of whether one use...

Design of high volume TCP Client

I have a .NET TCP Client that sends high volumes of messages to a (.NET async) TCP server. I need to keep sending messages to the server but I run out of ports on the client due to TIME_WAIT. How can a program continually and reliably send messages without using all of the available ports? Is there a method to keep reusing the same ...

TCP Connection Life

How long can I expect a client/server TCP connection to last in the wild? I want it to stay permanently connected, but things happen, so the client will have to reconnect. At what point do I say that there's a problem in the code rather than there's a problem with some external equipment? ...

IPv6 and ports

How do ports (or their functional equivalent) work with IPv6? Thanks! The Wikipedia article points out that the syntax of an IPv6 address includes colons and has a short form preventing fixed-length parsing, and therefore you have to delimit the address portion with []. This completely accounts for the odd parsing errors. ...

Why can't I connect to a WCF service with net.tcp but i can with http?

I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the NetTcpBinding instead. When i try to do that i get this error: Could not connect to net.tcp://zzz.xxx.yyy/...

How to Create a TCP socket connect using C to a predefined port

Hi, I have a very simple question. I want to test whether a particular port is currently under use or not. For this, I want to bind a TCP socket to the port, if the connection is refused means the port is in use and if not that mean the port is free. Can someone please tell me how can I write the TCP socket code in C? I am on a solaris...

TCP connection quality in .NET

I have a mission-critical real-time data application that uses a TCP connection between the client and server. In some cases, the connection periodically dies (SocketException). No problem - just reconnect and move on. However, the customers aren't thrilled with these intermittent drops in connectivity. I'd like to know where to point t...

MMORPG Client/Server Coding

How are the UDP and TCP protocols used in MMORPG client/server communication? For example: Does the client broadcast (player position, etc) via UDP to the server? or vice versa? Or is it more like using TCP where the Client requests that the server move the player. The server receives the request, moves the player and sends back to t...

Assigning TCP/IP Ports for In-House Application Use

I've written a WCF Service hosted by a Windows Service and it needs to listen on a known TCP/IP port. From what range can I safely allocate a port for use within my organization? That port will be embedded in the config files for the service and the clients that are consuming the service. ...

How do you go about compiling a modified version of FreeBSD?

I'm working on an assigned group project at University where we have to re-implement the TCP/IP stack to support some extra stuff (http://discolab.rutgers.edu/mtcp/), and then demonstrate it. The thesis/design we're working from says the original researchers changed the sourcecode for FreeBSD to support the extra bits and bobs. We've g...

How to keep a Php stream_socket alive?

I have a Php application using stream_socket_client(), to get data through tcp from a back-end server, but would like to keep the connections alive or even better in a pool or something to avoid the connect/disconnect over head. But I'm not a Php guru, so I have no idea how to do this. And although I could probably figure it out in a fe...

What causes a TCP/IP reset (RST) flag to be sent?

I'm trying to figure out why my app's TCP/IP connection keeps hiccuping every 10 minutes (exactly, within 1-2 seconds). I ran Wireshark and discovered that after 10 minutes of inactivity the other end is sending a packet with the reset (RST) flag set. A google search tells me "the RESET flag signifies that the receiver has become confus...

Creating a TCP Client Connection with SSL

I'm trying to create a TCP connection and send/read data that uses SSL, but I haven't been able to successfully accomplish this. What I'd like to do is something like this: TcpClient _tcpClient = new TcpClient("host", 110); BinaryReader reader = new BinaryReader(new System.Net.Security.SslStream(_tcpClient.GetStream(),...

OpenSource tools/services for server monitoring

I'm looking for an OpenSource server monitoring tool that allows the following: Monitor a variety of services on TCP, UDP. Supports custom port numbers. Supports some basic response checking (beyond initial connection checking). Basic dashboard overview of health status. Alert notifications via e-mail. I could roll my own, but want t...