sockets

What are the alternatives to Socket Programming?

I was browsing around for programming troubleshooters, and I was wondering what the alternate would be for Socket Programming; if there is one. ...

Good intro to TCP socket programming in Java?

I'm looking for a good tutorial on tcp socket programming in Java. The emphasis is on Good here, often I find that when I lookup this kind of guide I get halfway through before realising that either the person who has written the guide doesn't know what they are talking about or can't express what they know in a way that is condusive to...

Forwarding incoming TCP "Commands" to a function?

In Java, how would you set up a socket listener that listened to a socket for a series of bytes that represented a command and on recieving called a method which parsed the incoming data and invoked the appropriate command? Clarification: My issue is not with handling the commands (Which might also be error codes or responses to comman...

c# stream received all data?

I'm using C#.Net and the Socket class from the System.Net.Sockets namespace. I'm using the asynchronous receive methods. I understand this can be more easily done with something like a web service; this question is borne out of my curiosity rather than a practical need. My question is: assume the client is sending some binary-seriali...

How can I send a NULL in Ruby Sockets?

I'm working on a socket app in Ruby Shoes, and want to send a message to the server. The server expects the XML message, and then a null (0) character. How can I send that in TCP Sockets in Ruby? Thanks. ...

Does closing the BufferedReader/PrintWriter close the socket connection?

I have an application that uses simple sockets to pass some characters between two systems. I have my java application running as a server. I establish a connection fine, and even pass one message. However, after one message has been sent my connection closes. From what I can tell it appears as if on closing the printWriter and buffe...

How do I find a computer's IP address?

I am writing a program in C++ which uses network sockets. I need to find out what the computer's IP address is, so I can display it to the user. The program must run on Windows and Linux. I have heard somewhere that a computer can have multiple IP addresses. I want the one that other programs on different computers can use to connect to...

Why would my java program send multicast packets with a TTL of 1?

I have a java client program that uses mdns with service discovery to find its associated server. After much testing on a single network with Windows, Fedora 10, and Ubuntu 8.10, we delivered a test build to a customer. They report that the client and server never connect. They sent us a wireshark capture that shows the mdns packets h...

How do you handle Socket Disconnecting in Java?

Hey all. I have a server written in java using the ServerSocket and Socket classes. I want to be able to detect and handle disconnects, and then reconnect a new client if necessary. What is the proper procedure to detect client disconnections, close the socket, and then accept new clients? ...

Client Server programming in python?

Here is source code for multithreaed server and client in python. PROBLEM: In the code client and server closes connection after the job is finished. I want to keep the connections alive and send more data over the same connections to avoid overhead of closing and opening sockets everytime. What is the best way to do this? I am new to...

How does the socket API accept() function work?

The socket API is the de-facto standard for TCP/IP and UDP/IP communications (that is, networking code as we know it). However, one of its core functions, accept() is a bit magical. To borrow a semi-formal definition: accept() is used on the server side. It accepts a received incoming attempt to create a new TCP connection from ...

Read constant UDP stream in php

how do i go about reading data being sent almost constantly to my server. the protocol is udp. if i try to read in a while(1) loop, i dont get anything. it seems like the read will only echo once all the reading is done. so it waits till the loop is done reading which it will never be. i want the socket_read to echo immediately when it g...

SocketException on Windows Server 2003

I am trying to get an FTP application up and running on Windows Server 2003, before this application was on windows XP professional running with no problem. I have tried googling around for answers, but the only "workaround" I can seem to find on Microsoft’s website didn’t correct the problem (being edit the registry and add a new field...

variable length packets in php

I am receiving packets sent to my server through UDP. I am using socket_read to read the data and it is coming along just fine. I have run into an error however. The length parameter to socket_read in my case is NOT always the same. The length of the data can range anywhere from 50-150 bytes. One thing that remains constant is that the d...

What is the best way to implement a heartbeat in C++ to check for socket connectivity?

Hey gang. I have just written a client and server in C++ using sys/socket. I need to handle a situation where the client is still active but the server is down. One suggested way to do this is to use a heartbeat to periodically assert connectivity. And if there is none to try to reconnect every X seconds for Y period of time, and the...

Is there performance penalty on managed code when reading/writing high data volume on TCP/UDP socket compare to unmanaged code?

Do you think C# TCP/UDP socket use in the managed application can handle (roughly) same amount of data as native C++ version? If not, what is data amount we shall consider native or c# is better to use and what is the biggest obstacle in the implementation on managed side? ...

Joining 2 Sockets?

Is it possible to join two sockets? For example, if a process is acting as a router of messages between 2 other processes at some point being able to step aside would save a bunch of socket IO. This seems like it should be possible, but I've never even HEARD of it being done! If it is possible, is it possible on Linux AND Windows? If ...

How do I find the current machine's full hostname in C (hostname and domain information)?

In a C project (POSIX), how do I get the fully qualified name for the current system? For example, I can get just the hostname of my machine by doing gethostname() from unistd.h. This might give me machine3 in return, but I'm actually looking for machine3.somedomain.com for example. How do I go about getting this information? I do not ...

Number of sockets available for a JDBC connection at Windows 2003

My team built a Windows Service in Java that connects to a SQL Server 2005 in a Windows 2003 Server, using pure JDBC (no connection pooling) with the JTDS driver. After a while, the method that opens the connections to the database start raising exceptions with the following stack trace: java.net.BindException: Address already in u...

How should I handle socket disconnections in .NET?

I'm building a (LAN) network application, so there is always the possibility that a connection will be disconnected, for various possible reasons. I am trying to think of a good design for handling this issue, such that it doesn't affect the rest of the application. I wrote a quick thing to try to do it, but I think it can be enhanced a ...