sockets

Checking whether SendAsync has finished sending

As in the simplified code below, is checking that SendAsync() has finished transmitting all intended bytes in the buffer the correct thing to do? Or is that redundant? This is for a TCP connection socket. I am particularly concerned with having to issue a second sub-call to SendAsync() inside ProcessSend(). For example, if I had multip...

SSLSockets and problem with Cipher Specs

Hi I'm trying to get my java client to communicate with a C server using SSL. The problem is - I don't have any server sources and I'm getting a handshake failure error: Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at com.sun.net.ssl.internal.ssl.Alerts.getSSLException...

How two browsers simultaneously listen on port 80 ?

When I try to bind socket to port 80 from program I get error, but how two browsers simultaneously could listen to same port 80 ? ...

Is there a Java-applet implementation of HTML5 WebSockets?

Is there a Java-applet implementation of HTML5 WebSockets? I'd like to use WebSockets for a new project, and provide a backward compatible implementation of WebSockets (for all current non-dev browsers) using Java (or maybe Flash). I only want to write and maintain WebSockets on the server-side. I only want to have to deal with the We...

reading from input stream of socket without busy waiting in JAVA

i want to read from input stream when i connect to a server socket. but there may exist some delays between messages how can i read from input stream without busy loop ? string mes = socketReader.readLine(); above line returns null when no input provided in socket input stream. i want to be notified somehow when a message is ready in ...

can a Flash app running in browser connect to localhost to get data from another app?

it seems that Flash was supposed to run in a sandbox in the browser. But, if Flash can get data from a remote server, can it similarly get data from localhost IP on the same machine? In other words, can I use a Windows app that provides a TCP socket on localhost to feed data into a Flash app? EDITED: ok, the answer is yes at least for ...

Network Communication between a java socket (server) and a C++ socket (client)

I know this must be a pretty common problem, but I haven't been able to find a definitive answer on how to do it. First, assume we have a java server that accepts queries such as (I've just put the relevant lines, and I've taken out the exception handling for clarity): ServerSocket socket = new ServerSocket(port); while (true) ...

How do I connect to a local Socket in C#?

I'm trying to adapt this python code I found for connecting to the Dropbox daemon: def connect(self, cmd_socket="~/.dropbox/command_socket", iface_socket="~/.dropbox/iface_socket"): "Connects to the Dropbox command_socket, returns True if it was successfull." self.iface_sck = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self.sck...

How to get at TCP RTT on Windows (Linux TCP_INFO) as an user

I am porting a streaming TCP app from Linux to Windows. The app streams real-time audio data using a preexisting TCP protocol (so switching to UDP isn't an option). Further, I wish to avoid being "part of the problem" and requiring Administrator rights. The Linux code uses getsockopt(... ,SOL_TCP, TCP_INFO, ..) to get the RTT (roun...

Socket.Receive - where is the end?

Hello! I want to receive data from a client. To be precise, all data the client sends. But then I want to send some data back so I don't want to close the connection. Maybe it's already to late in night (at least in Germany) - how can I do this? Usually I would say I'd put a semicolon or something like that in the end, but protocols l...

Tcp connection another android device, based on phone # instead of IP?

For the current Android application I'm working on, I'm looking to create a tcp connection between the user device, and another Android device based on the phone number instead of the IP address. IE the user would open your contacts list, and be able to create a tcp connection to a contact using the same application as you. I seem to re...

How bind socket to device in windows?

I have same network cards in computer. All cards has identical IP. I need to bind socket to specific card. In linux I can use flag SO_BINDTODEVICE. How I can do this in windows. P.S. This needed for UDP sockets. ...

Is it safe to cast SOCKET to int under Win64?

I’m working on a Windows port of a POSIX C++ program. The problem is that standard POSIX functions like accept() or bind() expect an ‘int’ as the first parameter while its WinSock counterparts use ‘SOCKET’. When compiled for 32-bit everything is fine, because both are 32bit, but under Win64 SOCKET is 64 bit and int remains 32 bit and i...

How does one set SSL ciphers when using CFSocket/CFStream in Cocoa?

I recently needed to configure CocoaHttpServer, which we're using in our application with success, to handle HTTPS connections coming from a client application (running on Android devices). This is fine - there is copious sample code which allows for this, and we were able to enable the secure server without issue. In practice we were s...

when is IPPROTO_UDP required?

When is IPPROTO_UDP required? Is there ever a case where UDP is not the default protocol for SOCK_DGRAM? (real cases, not hypothetical "it might be", please") i.e., what are the situations where the following two lines would not produce identical behavior? if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) if ((s=socket(AF_INET, SO...

How to send an Object from one computer to another?

I know that the Java can use the Socket Programming to send an Object. Apart from socket programming, anything other way to do it? ...

Please suggest a secure way to transfer data from one computer to another.

I want "A" computer to responsible for execute the command, and "B" computer will send the command to "A" computer. I have some ideas on the implementation. Way1: The "A" computer have a while true loop to listen for "B" computer's command, when it is received, it execute. Way2: Using a FTP Server, that store information that about ...

What is a good way of sending data as strings through sockets?

Hi As there several ways to exchange data in the form of strings over sockets, such as e.g: using functions like: 1) sprintf() and sscanf() 2) snprintf() and sscanf() 3) printf() and strtof() or converting to char and then pass it as an array I would appreciate if you could suggest which way and why is efficient and better than ot...

What is a good way to connect multiple clients to the server?

Hi, As there are serveral ways of connecting multiclients to the server such as: fork, select, threads, etc. I would be glad if you could describe which is better to connect multiple clients to the server? Thanks for you time and reply? ...

Problem with winsock recv() and accept()

I'm having trouble with a socket application I'm programming in C++. I'm doing my programming with Bloodshed Dev-Cpp on Windows XP. I made a class for handling all the message transfers and have a client and server program that both use that class for handling their services. The application itself is very basic, the only intent I hav...