sockets

How to create sockets in javascript ...

I am creating firefox extension. I need to use sockets. I need it to work over http protocol. Is there any javascript library for creating http sockets. Communication is peer to peer so I need client socket and server socket in javascript it need to work over port 80 so it must follow http protocol. ...

How to send XML data through socket InputStream

Hi, I'm trying to write a client-server application in Java with an XML-based protocol. But I have a great problem! See this part of client code: InputStream incoming = skt.getInputStream(); //I get Stream from Socket. OutputStream out = skt.getOutputStream(); [...] XMLSerializer serializer = new XMLSerializer(); //This create an XML...

Yahoo online multiplayer games: one Socket per opened window / game ?

I would like to know how they do it, or what is the best approach for doing it. Both server side and client side are in question. After finishing my gaming site, the next phase is to provide multiplayer games in Silverlight. For me, the simplest method seems to have one Socket per window / game opened, but it may be more reliable to hav...

How to cast sockaddr_storage and avoid breaking strict-aliasing rules

I'm using Beej's Guide to Networking and came across an aliasing issue. He proposes a function to return either the IPv4 or IPv6 address of a particular struct: 1 void *get_in_addr( struct sockaddr *sa ) 2 { 3 if (sa->sa_family == AF_INET) 4 return &(((struct sockaddr_in*)sa)->sin_addr); 5 else 6 return &(((st...

How to set different timeouts for each socket that select() monitors?

I am currently using the BSD sockets API. I would like to use the select() function to monitor (a) the listener socket which waits for new connections using accept(), and (b) all the client sockets created via accept() or connect(). I want the listener socket to not have any timeout, and I want each client socket to have a timeout of 120...

Can PHP asynchronously use sockets?

Typical PHP socket functionality is synchronous, and halts the thread when waiting for incoming connections and data. (eg. socket_read and socket_listen) How do I do the same asynchronously? so I can respond to data in a data received event, instead of polling for data, etc. ...

Does socket data need to be error corrected?

When using socket communication in PHP, do I need to confirm if a message has been successfully received after sending each message? Or would the transport layer (TCP) take care of error detection and correction, ensuring successful delivery of any sent messages? ...

Acquire an IP address from dhcp server for my C# app - Like Virtual Machines

Hi, I'm developing an application of multiple socket connections (a TCP alarm watcher). Currently, in order to mock the alarms, i made small applications running on a VM Machine (that is, because the Vm have a different IP) that simulate the alarm endpoints. What I want to do is to mock the alarms in the same machine I'm running my "ser...

UDP broadcasts are not being received by sender

Platform: Windows 2003 R2, C# I have an application that sends UDP messages to other instances of itself, running on the same computer and on other computers. This is working fine. But, on some computers, the listener cannot hear messages that other thread/process on the same computer has transmitted. The message is broadcast ok, and...

connection reset by peer

What is the meaning of the "connection reset by peer" error on a TCP connection. Is it a fatal error or just a kind of notification ? ...

Socket in use error when reusing sockets

I am writing an XMLRPC client in c++ that is intended to talk to a python XMLRPC server. Unfortunately, at this time, the python XMLRPC server is only capable of fielding one request on a connection, then it shuts down, I discovered this thanks to mhawke's response to my previous query about a related subject Because of this, I hav...

Is it possible to force a packet to be fragmented in Java?

Hi, I have a bug which is caused by fragmented packets. I would like test this bug by creating a fragmented packet in the test and sending it to the software containing the bug. How would I go about doing this? Any guidance or alternative approaches appreciated, thanks. ...

Can a PHP script detect if a socket has been closed?

How can a PHP script detect if a socket has been closed by the remote party? ...

getpeername() doesn't work with connections to localhost

EDIT: Restating the problem, if I am listening to port 54321 and a local process listening to port 12345 connects to me, creating socket s, how do I actually find the port it is listening on? sockaddr_in addr; int len = sizeof(addr); getpeername(s, (sockaddr*)&addr, &len); cout << string(inet_ntoa(addr.sin_addr)) << ":" << ntohs(addr.si...

Multithreaded chat-server in Java

I'm trying to implement a server-client socket program in Java that can support multiple clients, but my class that performs the multithreading always crashes whenever my client connects to my server. import java.io.*; import java.net.*; public class ClientWorker extends Thread{ Socket cwsocket=null; public ClientWorker(Socket...

Sending int through socket in Java

What is the best possible way to send an int through a socket in Java? Right now I'm looking at sockout.write((byte)( length >> 24 )); sockout.write((byte)( (length << 8) >> 24 )); sockout.write((byte)( (length << 16) >> 24 )); sockout.write((byte)( (length << 24) >> 24 )); and then trying to rebuild the int from bytes on the other s...

iPhone TCP/IP Socket Server/Client Program

I have read a lot of questions regarding this subject on this website however they didn't quiet answer my question. If you can't be ### about my goal or background skip to the question. My Goal Is to build a server that can run on Mac OS X 10.4+ and later, port it to Windows XP/Vista (no idea how to do that yet, but that's a problem f...

cannot find -lsocket, compiling problem in client-server program?

I am trying to do some socket programming, writing a simple client-server program. But when I try to compile the program, I get this error. gcc -o showip showip.c -lnsl -lsocket -lresolv showip.cc: In function ‘int main(int, char**)’: /usr/bin/ld.real: cannot find -lsocket collect2: ld returned 1 exit status I try to install lib doing...

SSL_accept hangs after calling fork()

Hi I'm writing an app in C++ using openssl, and I can't seem to get the ssl socket connection to work. I have an abstract class, with multiple functions implemented using various protocols by the inheriting classes and simple TCP and UDP ( posix sockets ) work fine. I could not get the ssl working though and after some code browsing ...

eclipse + tomcat error

I get the following error when trying to launch tomcat (6.0.20) from within eclipse (galileo) SEVERE: Error initializing endpoint java.lang.Exception: Socket bind failed: [730014] The system detected an invalid pointer address in attempting to use a pointer argument in a call. at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoi...