sockets

Simulating Failures with Sockets and LibEvent

I'm building a fault tolerance system, and I need to be able to simulate socket errors that are low level. That is, I would like to forcibly close them and simulate physical real world events in a reliable manner. Are there tools at an OS level that let me mess around with sockets? If so, what are they. ...

Jruby socket error

Hi all! I'm useing netbeans and Jruby. When I want to build a project I got the following message: SEVERE: library `socket' could not be loaded: java.lang.LinkageError: loader (instance of java/net/URLClassLoader): attempted duplicate class definition for name: "org/jruby/ext/socket/RubySocket" Can anybody help to me what could be th...

Sending large xml data through a socket

I'm newbie to XML using Java. I've to write a method to send a large XML data having lots of nodes through a socket to client application. What is the suitable method to generate XML? What is the best method to send large XML through sockets? ...

bind datagramsocket to inetaddress

When I use serverSocket = serverChannel.socket(); serverSocket.bind(new InetSocketAddress(InetAddress.getLocalHost(), 0)); for tcp-based sockets, I get given the address 192.168.0.2, but when I use udp: serverSocket = new DatagramSocket(new InetSocketAddress(InetAddress.getLocalHost(), 0)); I always get a null or 0.0.0.0 addr...

socket open to http url and retrieve a data

I would like to open a socket to http url (https://www.abc.co.uk:8433/open/url/client?username=123&password=456) using socket and connect and recv methods of socket.h. The problems are that the url is using 8433 port and the remaining url (/open/url/client?username=123&password=456). Also using https url. Dose anyone know how to do...

Image transfer between C++ and Java via Socket

Hi everyone, I would like to transfer an image from a Java application to a C++ application. I am using sockets as the communication method, and for now this works good with strings. I want to be able to transmit it both way (Java <-> C++). The image is NOT a file, this is a memory object/structure. So my main problem is how to encode...

Socket's input byte stream wrapped in two different stream types?

I'm trying to implement such a protocol: Client side: 1) client sends command (String) 2) client sends object 3) client receives object or data [depends on command] Server side: 1) server reads command (String) 2) server receives object [type depends on command] 3) server sends object or data [depe...

Socket 'No route to host' error.

I have a connection which is behind a restrictive firewall which only allows HTTP(S) access through a proxy (10.10.1.100:9401). The IP address I get is dynamic and the subnet mask is 255.255.255.255 (I know, weird!). I tried to write a simple Python socket program to connect to the proxy in order to send some HTTP requests: import sock...

Transmission of float values over TCP/IP and data corruption

Hello all. I have an extremely strange bug. I have two applications that communicate over TCP/IP. Application A is the server, and application B is the client. Application A sends a bunch of float values to application B every 100 milliseconds. The bug is the following: sometimes some of the float values received by application B a...

Can a servlet open a socket to talk to native code?

I have a C API that talks to hardware and I want to ultimately make calls to that API from a browser. Thinking some to the c++ servlet lib's are too complicated, as is JNI, I thought I could prove the concept like this: A java servlet gets a simple string message via HTTP. The servlet opens a socket to pass along data via UDP. C process...

Reusing a port number in a UDP

In ASIO, s it possible to create another socket that has the same source port as another socket? My UDP server application is calling receive_from using port 3000. It passes the packet off to a worker thread which will send the response (currently using a dynamic source port). The socket in the other thread is created like this: udp:...

Asynchronous Sockets implementation on Android

In iPhone there is Cocoa Asynchronous socket library. Is there a similar library in Java for Android? Can it be done using Java Asynchronous sockets(NIO library) or is there a way I can make use of NDK for Android and use native libraries for asynchronous sockets? ...

When should I use TCP_NODELAY and when TCP_CORK?

Hi, I understood that both of them disable Nagle's algorithm. When should/ shouldn't I use each one of them? Thank you. ...

Reading an async socket continuously

I have already read other similar question about that problem, but that don't work for me. I'm building an iPhone app that talks with a TCP server (windows, but never mind) and I'm using AsyncSocket from cocoaasyncsocket (googlecode). It's a very useful class, but I can't use that at all. In my code I create a "connector" which I all...

Writing output from a socket

I have 2 machines A and B. In machine A, I do echo "Hello World" > /dev/tcp/{Bs_ip}/12345 In machine B, how do I write a script that runs in the background, listens on port 12345, and prints whatever it receives from port 12345 to stdout? BTW both machines are running Red Hat Enterprise Linux AS 4. Thanks ...

Checking setSoTimeout for DatagramSocket() in Java

Hi. I'm fairly new to java and I have a, probably, very easy question to answer. I have a DatagramSocket and i have set the setSoTimeout to be around 2 seconds. I know from the Java library that if a recieve() is issued to this socket and 2 seconds passes and it doesn't recieve a reply, an exception is raised (java.net.SocketTimeoutExce...

Winsock: How to stop sending/receiving without closing the connection

Hi there, I am not very familiar with winsock or network programming, so I hope you forgive me if I am asking stupid stuff :) I develop a client/server application which share some camera images. The general cycle is: The client captures a camera image and compress it to an binary image. After that it sends it to the server The serve...

File descriptor of a java datagram socket

Hi, How do I get the file descriptor of a Java Datagram socket? I've searched the web without any success. Srini ...

connect c# to java

I am trying to write a program in which the client code is in c# and server code is in java. Client side: On clicking a button on the form, some text goes from the client and gets displayed on the server Server side: Java program. The server just listens for clients. Socket programming is used code is like this, but its not wo...

Udp socket communication on same port on a computer

Hi,I have 2 programs on the same computer, communicating using udp socket. While program A running, I want to extract some information to program B. Using the SO_REUSEADDR socket option, I am able to bind 2 programs to the same port. However, when program A sent a message, program A itself, instead of B, received the message and display ...