sockets

Programme goes unresponsive at ServerSocket.accept - Java

My programme listens for just one connection once... the programme just gets stuck at clientSocket = serverSocket.accept() if no client connects. I mean I can't even interrupt it by closing my window. I can't click any of my buttons in the frame etc. I've used this code the same way in my other programmes but it's worked fine (I can cli...

Release socket in Boost.Asio (opposite of assign), or not transfer ownvership

Hello, There is a function assign in Boost.Asio sockets, however I'm looking for something like release/unassign that would transfer the ownership on socket back to user. or some type of assign that would not transfer ownership to socket class, so it would not close it when destroyed. I'm aware of this solution but it involves d...

Flushing the socket streams in C socket programming

I wanted to know how to flush the socket streams while doing socket programming in C. I tried all the options- setting TCP_NODELAY using the following code- setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); Note: all the flag and sockfd are declared correctly. I used this function both before send() an...

Setting DIFFSERV/DSCP with GQOS for specific socket in c

I need to set the DSCP field of packets sent from a specific (tcp) socket in windows XP. It seems that the GQOS API should serve this purpose (see http://blogs.msdn.com/wndp/archive/2006/07/05/657196.aspx) but I really, really, can't find any working example or figure how to use it on my own. I would be very grateful if anyone of you h...

When does a Java socket send an ack?

My question is that when a socket at the receiver-side sends an ack? At the time the application read the socket data or when the underlying layers get the data and put it in the buffer? I want this because I want both side applications know whether the other side took the packet or not. ...

Problem with Java selector/SocketChannel

I'm having a problem with a multiplayer game. Right now, I'm just trying to get the server to send the current level to the client. The server is definitely sending the data, but it never gets to the client application. Client code: public void run() { while(true) { try { sel.select(); Set r...

Ruby Tcp Server class with non-blocking or mutlithread functionality

Hello Can't find any gem or class which can help to made a non-blocking/multithread server. Does anybody know where to find any ? ...

How to read bytes from a Socket in Haskell

I'm trying to read a number of Bytes from a socket in Haskell. Bascially I want to do something equivalent to this: client_socket.recv(255) #(Python) What's the best way of doing it? ...

c++ Socket select and receive problem

Hi all; Below is the code fragment I have issue with socket programing. Here after select call, If I do not put a sleep on line 9, on Windows XP, 1 byte is received on line 11 (instead 4 byte is sent from server as integer), when I check xmlSize, it is set to 0. Because iResult is 1, execution continues and on line 15 second receive is c...

Silverlight and clientaccesspolicy.xml

I have a silverlight app hosted on "dev.system-engine.com" which creates an tcp connection connecting to "dev.system-engine.com" the silverlight app and the policy file are on the "dev.system-engine.com" webserver. "system-engine.com" and "dev.system-engine.com" are separate servers. I cannot seem to get it to work. I have been strugg...

Execute and output PHP on a C based web-server - Stuck!

Hi all, I'm doing a bit of coursework for university and I'm completely baffled. Basically I've made a basic web server (which uses sockets) in C. I've now got to make it so that any .php file, is run through the php compiler and output. The problem I'm having is that I've tried using system() and execlp() (the latter was recommended b...

Help with Cross-Domain file for ActionScript 3 Socket

Here is My ActionScript Code: var S:Socket=new Socket("127.0.0.1",2222); Here is My CrossDomain.XML File (Located at http://127.0.0.1/crossdomain.xml) <?xml version="1.0"?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt; <cross-domain-policy> <allow-access-from domain="*...

C: Question about Beej's networking guide... Is there an assumption here?

I was just going through the Networking Guide by Beej and am curious about this part of the code (specifically marked with "From here" and "To here"): // main loop for(;;) { read_fds = master; // copy it if (select(fdmax+1, &read_fds, NULL, NULL, NULL) == -1) { perror("select"); exit(4); ...

Using Perl's readline , <> function with TCP socket and Signals

I'm using Perl 5.8.8 and trying to determine if Perl automatically and consistently restarts the readline function ( better known as <> ) if it's interrupted by a signal. I want to safely read newline '\n' terminated strings from a TCP socket using readline. In the section Deferred Signals (Safe Signals) it says: Restartable syst...

Set and Read/Retrieve cookie using javascript within a java file(.java)

Let me refrase it. i am writing a new http-server using sockets in java-language(not javascript) and i want to tell client to set cookie. I would like to do that in javascript(setin reading the cookie). If that is not possible, Are there other solutions? Thank you all. ...

Maximum number of socket in java

How many is the maximum number of sockets in java under windows? How can I change it? ...

How do I re-bind a socket in MacOSX/Ubuntu? A second time

I have the following code: if ( ( m_mainSocket = ::socket( PF_INET, SOCK_STREAM, IPPROTO_TCP ) ) < 0 ) { throw Exception( __FILE__, __LINE__ ) << "Unable to create socket"; } int on( 0 ); if ( setsockopt( m_mainSocket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof( on ) ) ) { throw Exception( __FILE__, __LINE__ ) << "Can't make server...

Mono C# Getting data from socket gets OutOfMemory

I have this simple code running on my windows server just fine, but when I run it in mono after a couple days I start getting only OutOfMemory exceptions. public static byte [] TryReceive (Socket sock, out int nLength) { nLength = 0; try { int size = sizeof(int); byte [] data; int recv = 0; int offset = 0; d...

How to create a basic Java Server?

Essentially I want a basic Java Server which multiple people can be connected to and when one of the connected clients (Already coded in Obj-c) sends data to it, it sends it back to everyone who is connected. I'm a real Java Newbie and I'm not going to need Java in the forseeable future for anything but this so I want it out the way as ...

Java socket close timeout

In java when you close a socket it doesn't do anything anymore but it actually closes the tcp connection after a timeout time. I need thousands of sockets and I want them to be closed exactly after closed them not after wasting my time and my resources! What can I do? Thank you. ...