sockets

Android TCP socket and Streaming. No Errors or exceptions when sending data after conectivty loss.

Hi, Im trying to determine if data was successfully sent to the server through a TCP socket using the OutputStream object. for testing purposes i disable network communications in the phone and OutputStream.write(); doesn't throw an exception, all the methods in the socket class return as though the socket is active and working. Is there...

Java Socket Read Time Out Exception thrown only after Network comes back after being disabled at start up

I am working on a distributed application that communicates over socket connections. I'm not sure if this matters with the problem but it is a Netbeans RCP application. There are 2 different client sides of it which simply display the status of their connection to the server, send requests to the server side and display the responses r...

client / server program in c++ problem

Hi all, I have created a client and server program in c++ based i=on windows sockets. I have some problem that when i execute the program no message appears on the server end and after that the program exits.Data is sending to server but it is not responding back. i am pasting my code below ****Server code ===========**** #ifndef WIN3...

Why would connect() give intermittent EINVAL on port to FreeBSD?

I have in my C++ application a failure that arose upon porting to 32 bit FreeBSD 8.1 from 32 bit Linux. I have a TCP socket connection which fails to connect. In the call to connect(), I got an error result with errno == EINVAL which the man page for connect() does not cover. What does this error mean, which argument is invalid? The m...

Socket Programming - Sending/Receiving hex and strings

I have the following code in C#: Console.WriteLine("Connecting to server..."); TcpClient client = new TcpClient("127.0.0.1", 25565); client.Client.Send(BitConverter.GetBytes(0x02)); client.Client.Send(BitConverter.GetBytes(0x0005)); client.Client.Send(Encoding.UTF8.GetBytes("wedtm")); Console.Write("{0:x2}", client.GetStream().ReadByte(...

Javamail does not completely close socket on timeout

When sending a mail trough javamail, a socket to the smtp server is opened. Now, we got the case, that the connection of the mail server went down while the connection was still alive and while javamail was waiting for the server (spam scanning took a few seconds). Therefor the TCP connection was never really closed and the client deadlo...

C# Socket.BeginSend Sometimes Seems to Behave Synchronously?

While attempting to send a message for a queue through the BeginSend call seem te behave as a blocking call. Specificly I have: public void Send(MyMessage message) { lock(SEND_LOCK){ var state = ... try { log.Info("Begin Sending..."); socket.BeginSend(message.AsBytes(),0, message.ByteLength, SocketFlags.None, ...

How can I fix conflicts of server received RTSP messages on TCP communication?

Hi guys, I would like to have some advices because I've got conflict between clients sending RTSP messages to the server. First at all I apologize to you all for my English. Well, what I'm doing is a java streaming video application. clients set TCP connection with the server for exchanging RTSP messages server sends over UDP, to t...

PHP Sockets, any way to speed this up

I'm writing a small script to see if certain ports on certain devices are in use or are open. My code is: for($c=1;$c<=16;$c++){ echo "<tr><td>Pod " . $c . "</td>"; for ($d=5000;$d<=5010;$d++){ $tmp=fsockopen("10.0.0." . $c,$d,$erstr, $errno, 1); if($tmp){ echo "<td class='o'>OPEN</td>"; fclose($tmp); } e...

How to connect to modems within tcp clients in multiple port or other way?

I have around 5000 modem (thin clients), and I want to communicate with them, one of a my method is like this : string GetModemData(modemID), now I have an open port in server that listens to modem and I'm using socket programming to send data to modems (calling related function), but when i want send data to multiple modem in a same tim...

select vs poll vs epoll

Iam designing a new server which needs to support thousands( somewhere between 100,000 sessions) of udp connections. What is the best polling method to use for socket FD's. I have read that epoll is better than select/poll. Any input or suggestions on which one to use. Thanks. ...

python sockets, what's the best way to handle several connections at once ?

What's the best way to handle lots of connections at once in python? The first way I think of is threading, which works but at 10MB of RAM per thread that's rather expensive. So what other ways are there to handle lots of connections at once ? The only problem I see without using threads is that using the socket.recv() waits for data f...

.NET Socket.Receive() Not Receiving Large Data Streams from Java SocketServer

Java Socket Server I have a Java process that is creating a listener on a TCP Socket using java.io.ServerSocket something like this (simplified): ServerSocket server = new ServerSocket(4444,20); server.accept(); The Java Process Fires off a Worker Thread when a Request Is Received and the Worker then sends a JSON string using jav...

Socket.select not returning readable sockets in c#

I'm building a server that serves two clients using streamreaders/writers (using networkstreams), using newline symbols to indicate the start/end of a new command. Because readline (and writeline too, but that's not an issue), will block until there actually is a line to read, I use socket.select in order to determine when there is a li...

Sockets - How to find out what port and address I'm assigned

Hi, I'm having trouble figuring this out - I'm working with sockets in C using this guide - http://binarii.com/files/papers/c_sockets.txt I'm trying to automatically get my ip and port using: server.sin_port = 0; /* bind() will choose a random port*/ server.sin_addr.s_addr = INADDR_ANY; /* puts server's IP automatically ...

Python: unit testing socket-based code?

I'm writing a Python client+server that uses gevent.socket for communication. SAre there any good ways of testing the socket-level operation of the code (for example, verifying that SSL connections with an invalid certificate will be rejected)? Or is it simplest to just spawn a real server? Edit: I don't believe that "naive" mocking wil...

Live Streaming ( Socket ) - How to sync audio and video ??

1- Which one is better to use for streaming video ? TCP or UDP socket and why? 2- While streaming live, audio and video are coming from the server separately, so how can i make sure that the video i display and the audio I play on the device are in sync? ...

(How) can I use ServerSocket to listen for UDP instead of TCP traffic?

In my application, there's a module that uses ServerSocket to listen for incoming TCP connections. When I switched a client to use UDP, I expected to receive data anyway, but I was wrong. When I looked at the documentation, however, I couldn't find any config option to set up the socket for UDP. Do I have to use a different class? ...

TCP Socket Hangs while receiving in Java

Hello Experts, I am using the TCP Socket in my Java application. I am trying to receive the byte data from some device. I am using the readInt(); method for receiving the data form the device. This method works fine if i am getting the 4 bytes from the device and if the bytes are less then 4 bytes or nothing then readInt(); hangs(blocke...

maintain session/connection between php and java app

A) If I have a java application which starts up and waits for socket connections on a specified port. Is there a way i could maintain a session connection in php after a user validates, i.e a persistent connection? B) I mean, I'm trying to understand how its done with mysql and php. How does mysql or php know what the last opened connec...