I am creating a non-blocking IO system for the server side of my project. The actual implementation isn't important (it is Java NIO if you care), but I feel very intimidated by the subtle issues you have to pay close attention to when programming socket communications. My knowledge is lacking in a lot of areas, so I can't even conceive...
For server side programming I use the listen function as:
int listen(int sockfd, int backlog);
I understand that the backlog should be less than or equal to the somaxconn set on the host system where I would run my server program.
If I use SOMAXCONN as the backlog, it will be equivalent to hard-coding it to the value of SOMAXCONN that ...
Currently my GUI is Freezing when I try to display data I read from my socket. It's not freezing when i display one, or two messages, only when I receive many messages(2-3 per sec). I am using async socket(non blocking). I guess it's related to how I display the data to the gui. Code:
public class Globals
{
public static MainDial...
I have an applet that I want to maintain a socket connection between multiple web pages. Currently, when a transition is made to a different page, the socket connection is closed. Is there anyway of maintaining that connection between web pages? Or, do you have to reconnect the socket after each web page transition?
...
I was setting up Django on Cherokee today (using SCGI), and I noticed that the Django docs say that you can use either a host/port combination or a socket for communication between the webserver and Django.
The only thing they have to say on the matter is
What you choose is a manner of preference; a TCP socket is usually easier due ...
A seemingly simple call returns an error, but I don't understand why. Can anyone please advise?
GUID * Guid = (assigned elsewhere)
INT ErrorCode, rc;
rc = WSCDeinstallProvider( Guid, &ErrorCode );
// rc == SOCKET_ERROR at this point and ErrorCode == 10014 (WSAEFAULT)
Thanks in advance!
...
I have a Flash client that I want to connect to a server. Both are using localhost and port 50000 so there shouldn't be any cross-domain problems. I also set Access Network Only in the publishing settings. When I call the XMLSocket connect, the server seems to get a new connection. But, the XMLSocket.onConnect callback is not called ...
I have clients that need to all connect to a single server process. I am using UDP discovery for the clients to find the server. I have the client and server exchange IP address and port number, so that a TCP/IP connection can be established after completion of the discovery. This way the packet size is kept small. I see that this could ...
I'm reading from a Java Socket in a loop.
I want to re-open the socket if a read throws an exception.
In an attempt to test that, I simply close the socket and catch the exception.
The catch is, when I attempt to re-open the socket:
serverSocket = new ServerSocket(port)
socket = serverSocket.accept()
it throws an exception:
java.n...
Hello there,
I have a quite simple problem here. I need to communicate with a lot of hosts simultaneously, but I do not really need any synchronization because each request is pretty self sufficient.
Because of that, I chose to work with asynchronous sockets, rather than spamming threads.
Now I do have a little problem:
The async stuf...
Hello network experts,
I have a pc with two network cards. One (eth0) is for LAN/internet and the other for UDP communication with one microcontroller (mc) device. The mc has an IP(192.168.7.2) and a MAC address. The second pc network adapter (eth1) has 192.168.7.1.
The mc has a very simple IP stack, so the easiest way for the mc to sen...
I was wondering if ASP.NET is more efficent than PHP with sockets. Ive frozen a server several times doing relatively few connections on PHP. I was wondering if any server side programming engines are capable of hosting a reliable and efficient socket server.
...
Hi
I opened a connection a server in the following way
SOCKADDR_IN SockAddr;
SockAddr.sin_port=htons(445);
SockAddr.sin_family=AF_INET;
SockAddr.sin_addr.s_addr=*((unsigned long*)host->h_addr);
// Attempt to connect to server
if(connect(Socket,(SOCKADDR*)(&SockAddr),sizeof(SockAddr))!=0)
{
printf("Failed to establish connection wi...
I am using TCP/IP socket programming. I have a floating point value stored in a variable ret_val in my server code which I want to send to the client which is waiting to receive it.
How can I do it?
...
Is there a way I can force a UDP socket (which is used by another process) to close or unbind, in c# programmatically?
...
Hi all!
I'm making an MSN client in PHP. I have this code, which connects to a server and logs in to MSN:
$server2 = explode(":", $xfr[3]);
$socket2 = pfsockopen($server2[0], (int)$server2[1]);
$_SESSION["socket"] = $socket;
echo '<b>Connected to 2nd server.</b><br />';
//Send MSNP version
fputs($socket2, "VER 0 MSNP10 CVR0\r\n");
echo...
Ok, I'm going crazy here. I have been rewriting the NIO code for my server, and running into some real headaches. The bottom line is that getting NIO "right" is very hard. Some people pointed me to the Rox tutorial at http://rox-xmlrpc.sourceforge.net/niotut/, which seems to be on a good path, but is not as complete as I would like. ...
Whenever I use 'ab' to benchmark a web server, it will freeze for a while after having sent lots of requests, only to continue after 20 seconds or so.
Consider the following HTTP server simulator, written in Ruby:
require 'socket'
RESPONSE = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"\r\n" +
"\...
Hi,
I'd like to do some network socket programming in C++ and have found the C++ Sockets library.
First, is this a good way to go in C++? Normally in C, I'd use some of the stuff beej describes in his tutorial.
Second, how do I compile the examples given on the site? I can't figure it out from their installation/configuration guide. ...
Hi,
This is potentially a newbie question, but if i open and write some data to a socket, then exit the subroutine so the socket goes out of scope, and then try and read the data from another program, at a later time, will the data still be there or does it die when the original declarations go out of scope ?
Thanks,
N.
Further info...