sockets

How to wait for an other process to start listening on a local port?

I have a test driver program that launches a separate test server process. The test server process listens on a local port, and after it's ready, the test driver runs a test that accesses the test server. Currently the test driver repeatedly tries to connect to the local port (loop some, sleep some, try again). It's not an optimal solut...

How can server push data to client ?

Learning java server technologies, trying to clarify some things. There are few technologies that allow java applications to communicate with each other. 1) Web services (REST/SOAP) over http 2) Simple POST/GET using URLConnection over http. 3) Sockets 4) RMI = Sockets + Object Serialization + Some Utilities 5) Different media serv...

How can I use the Packet Structure from an RFC and apply it to my socket program?

Here's an example 'Packet Structure' image: http://freesoft.org/CIE/Course/Section3/7.htm Lets say I had a small Python program that listened on X port and captured that packet and saved it to the variable 'data'. How would I pull out the packet information from data? For example, say I wanted to read the 'version', is it just: print ...

What's the redundant data in TCP packet?

I am reading "Unix Network Programming" and tcpdump the packet generate by the example. The example is just send out a packet contain string "liha". I read the TCP/IP RFC and found normal IP header is 20B. and normal TCP header except data is 24B. So, there are 8B before string "liha" in the captured packet. Are "0121 3d2a 0120 b43e" ...

socket programming in MATLAB ?

i have two machines running MATLAB and i need to exchange information(numbers,images) between them,is there a way in MATLAB i can do it? ...

J2ME app closes socket: Server doesn't get all data

Hi Folks! I have a problem with an J2ME client app, that sends data to an J2SE server, and immediately closes the sending socket. On the J2ME side, i use a ordinary OutputStream on a SocketConnection, and repeatedly call write with small packets of data (~30 bytes). Afterwards, I flush and finally close the stream and the connection. W...

processing time per thread??

hi every1 i want to calculate the process time per thread. how do i do it.? suppose my 100 threads are executing the same method work() concurrently, then if i put the following code help me get what i seek Process thisProc = Process.GetCurrentProcess(); string procName = thisProc.ProcessName; DateTime started = thisProc.StartTime; in...

socket / port / IP address?

Can You please give me some clear idea about Socket / Port / IP address and how they are working each other in a Client Server Program? ...

boost::asio fails to close TCP connection cleanly.

I am trying to implement a simple HTTP server. I am able to send the HTTP response to clients but the issue is that on Firefox I get "Connection Reset" error. IE too fails, while Chrome works perfectly and displays the HTML I sent in the response. If I telnet to my server then I get "Connection Lost" message, just after the response. So...

In python, when using select.select on socket objects, how should I handle sockets that end up on the error list?

read, write, error = select.select(sockets, sockets, sockets, 60.0) What is recommended if something ends up in the error list? ...

Secure data transfer over http with custom server

hi I am pretty new to security aspect of application. I have a C++ window service (server) that listens to a particular port for http requests. The http requests can be made via ajax or C# client. Due to some scope change now we have to secure this communication between the clients and custom server written in C++. Therefore i am looki...

byte provided for BeginReceive

what my program does is, At first connection accept, server sends data the client receive then sends again (Datasize does not change) Server receives it then sends back again .... this loop continues ... when the second time the server receives data the int returned by endreceive(); is 0 although i have found the solution but i dont k...

Linux blocking udp socket won't receive

Hello, I am openning a udp blocking socket on an ubuntu machine, it goes successful (no errors returned). When sending data to that machine and port from another machine the receive doesnt breaches and in a wireshark sniffer I see and Icmp error "port unreachable". I though it might be an iptables problem and opened the port for accep...

.Net async Socket multi-threaded sending

hello stack overflow! i have a socket, im using to send large buffers through, if ill do something like // may be accsed form a a lot of threads void Send(byte[] buffer) { m_socket.BeginSend(buffer ... , SendCallback); } void SendCallback() { m_socket.EndSend() // if not done sending- send the reset m_socket.BeginSend() } m...

Curl Record Download Information

Hello i am trying to record how much the user has downloaded when the user aborts the script i want the script to be able to save a text file with information how much they have downloaded with this i will have an idea how to create a quota program, i have tried fopen, fread works grate only one problem it i ant seek for the file, curl d...

[.NET] RDM Sockets

I've recently come across .NET's RDM Socket type (SocketType.Rdm) and its features sound very promising, sounding very much like a reliable connectionless protocol. However, I've found no examples of its usage, and little documentation on the protocol itself. First of all, how do I instantiate a socket of this type? Specifying SocketTyp...

Using sockets (nsIServerSocket) in XPCOM component (Firefox Extension) (sockets + new window = seg faults)

PLEASE READ THE UPDATE #2 BELOW IF YOU ARE INTERESTED IN THIS PROBLEM ;) Say I put this code into the JS of my extension. var reader = { onInputStreamReady : function(input) { var sin = Cc["@mozilla.org/scriptableinputstream;1"] .createInstance(Ci.nsIScriptableInputStream); sin.init(input); ...

accept() call does not blocks second time

I have written a small server #include <stdio.h> #include <netinet/in.h> #include <sys/types.h> int main() { int server_fd, newsock_fd, server_len, newsock_len; struct sockaddr_in server_struct, newsock_struct; server_fd=socket(AF_INET,SOCK_STREAM,0); server_struct.sin_family=AF_INET; server_struct.sin_addr.s_addr=inet_addr("127.0.0.1...

Prevent fork() from copying sockets

I have the following situation (pseudocode): function f: pid = fork() if pid == 0: exec to another long-running executable (no communication needed to that process) else: return "something" f is exposed over a XmlRpc++ server. When the function is called over XML-RPC, the parent process prints "done closing...

Applet signed throw: java.security.AccessControlException. How can I make it run?

After hours of work (I'm not a java programmer) I've managed to pack and put inside an applet wich make an ftp-upload to a remote server. The main file is "prova.class" inside "invia.jar"; I use a third-part library, placed in "edtftpj.jar". I have signed both file and included them in the page with the following code: Index.html <appl...