sockets

Context.Undo() error, only on Windows XP machine

Hi, I have an asynchronous socket and I get the following error ONLY on ONE windows XP machine: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The po...

Are there applications where the number of network ports is not enough?

In TCP/IP, the port number is specified by a 16-bit field, yielding a total of 65536 port numbers. However, the lower range (don't really know how far it goes) is reserved for the system and cannot be utilized by the application. Assuming that 60,000 port numbers are available, it should be more than plenty for most nework application. H...

Socket print to Toshiba B-SA4TM

Hi, I should print barcode labels to a Toshiba B-SA4TM printer. I have found a code snippet to print directly by socket http://goo.gl/rm5y But I can't figure out how I should pass commands. Does someone have some example please. Thank you very much. Kindly Elvisd ...

How to get computer's WAN IP address in Java?

How do i get the Wide Area Network of my computer with Java? I try with this: ServerSocket ss = new ServerSocket(port); System.out.println(ss.getInetAddress().getHostAddress()); //wich return 0.0.0.0 then i try with this: System.out.println(InetAddress.getLocalHost().toString()); //which return keenan-a658368c/192.168.1.100 < yes it ...

Performance considerations of a large number of connection on the same port

Hi, What are the performance considerations that one should take into account when designing a server application that listens on one port? I know that it is possible for many thousands of clients to connect to a server on a single port, but is performance negatively affected by having the server application accept all incoming request...

Why would connect() give EADDRNOTAVAIL?

I have in my application a failure that arose which does not seem to be reproducible. I have a TCP socket connection which failed and the application tried to reconnect it. In the second call to connect() attempting to reconnect, I got an error result with errno == EADDRNOTAVAIL which the man page for connect() says means: "The specifie...

How to tell on the server if a webservice client aborts (Axis2)

Environment: Client: JavaME, CDC/Foundation 1.1 with JSR-172 client library. Service stubs created with Sun WTK 2.5.2. Server: JBoss 3.2.8SP1 (don't ask, cannot be changed) with Axis2.war providing the webservices Problem: In the JavaME based program a background thread calls a webservice on the remote JBoss host. Depending on user...

Python to javascript communication

OK so im using websockets to let javascript talk to python and that works very well BUT the data i need to send often has several parts like an array, (username,time,text) but how could i send it ? I originally though to encode each one in base64 or urlencode then use a character like | which those encoding methods will never use and the...

POSIX Sockets; Deciphering Hostname from sockaddr_in structure

Hi. Is it possible to decipher the hostname given the sockaddr_in strucure? struct sockaddr_in { short sin_family; // e.g. AF_INET, AF_INET6 unsigned short sin_port; // e.g. htons(3490) struct in_addr sin_addr; // see struct in_addr, below char sin_zero[8]; // zero this if you want ...

gSOAP does **not** close sockets ??

Hi all, I've an issue with gSoap - it's not closing the socket.. Here's the situation: the application is working fine, but when I call "reload" function, it cannot reconnect.. Here's a piece of code: soap_destroy( &m_soapObj ); soap_end( &m_soapObj ); soap_done(&m_soapObj); sleep(1); soap_init(&m_soapObj); //m_ptrThis should be in...

Measuring and explaing the events between socket.send to the packet actually leaving the box

I am trying to find out the total time it takes from the point where my C# application calls Socket.Send till the time the packet actually leaves the box. What is the best way/technique/methodology/tool to measure it? I'd like to know and explain and measure all that happens between Socket.Send or BeginSend from my C# application till t...

How to detect opened sockets in Windows?

In Windows XP (SP2 if necessary), is there any way to detect, from a userspace application, that a TCP/UDP socket (from any process) has opened? I know of the GetExtendedTcpTable() and GetExtendedUdpTable() functions, but they only detect currently opened sockets. Some sockets close immediately after they're opened that the only way I'...

Java non-blocking socket

What's the best way to implement a non-blocking socket in Java? Or is there such thing? I have a program that communicates with a server through socket but I don't want the socket call to block/cause delay if there is a problem with the data/connection. ...

Good article on sockets?

I was just wondering where I could find a article on sockets. I don't want any indepth code. I just want to understand the structures and other stuff like the how the buffers work. ...

Why the connect failed for ipv6 at python?

Why the connect failed for ipv6 ?? # python >>> import socket >>> s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) >>> sa = ('2000::1',2000,0,0) >>> s.connect(sa) >>> sa = ('fe80::21b:78ff:fe30:7c6', 2000, 0, 0) >>> s.connect(sa) Traceback (most recent call last): File "<stdin>", l...

How can I send an array in client server program in Perl?

I have a Client-Server Perl program. I want to send a message stored in an array to the server. Server code: use IO::Socket::INET; # Creating a a new socket $socket=new IO::Socket::INET->new(LocalPort=>5000,Proto=>'udp'); print "\nUDPServer Waiting for client on port 5000"; while(1) { $socket->recv($recieved_data,1024); $pee...

How can i emulate non blocking i/o in java using threads

Hello, i m writing simple application involving a server and many clients at time. i have to use DataGramSocket. application is simple exchange of messages through console like in chatting. but both operations in.readLine() and ds.receive() are blocking and putting them in seperate threads didn't help as blocking i/o will block the thr...

Android to Dumbphone Bluetooth

Greetings Coders. I'm trying to establish a connection between my Android Phone and an old Dumbphone. When I use this: tmp = device.createRfcommSocketToServiceRecord(UUID.randomUUID()); I get: "Exception: Service Discovery Failed" With This: Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class}); t...

How does Boost ASIO receive_from return underlying socket errors?

i.e. will the blocking version return -1 on error. Or more to the point, how do you know the call failed? does boost::asio::ip::udp::socket::receive_from() return -1 on error The normal BSD socket API receive_from call will return -1 on errors and you can look at errno for the specific error code. Does the boost version do the same?...

How do I set the timeout of a SocketServer in Python?

I want to use server.get_request() to receive requests, but I want it to timeout after 500 milliseconds. Is this correct? Doesn't seem to work... thanks. class UDPServer(SocketServer.BaseRequestHandler): timeout = .500 if __name__ == "__main__": server = SocketServer.UDPServer(('localhost', '12345'), UDPServer) server.get_r...