sockets

Split up python packets ?

Is there a way python can distinguish between packets being sent ? e.g. python receives data it process data clients sends first packet client sends second packet python receives data, can i receive the first packet rather then all info in the buffer I know i can set it up up so it sends data i confirm and the client wont send more...

Alternative to Wireshark for raw Ethernet capture over USB-Ethernet adapter

(Apologies: I uninstalled and reinstalled WinPcap and now I can see the extra interface! Suggestion found in Wireshark FAQ. I leave the original question below.) I use WireShark to examine ethernet packet contents at the byte level (in/out of custom FPGA-based hardware). I have a USB-Ethernet adapter to add a second Ethernet port to my...

Winsock local loop-back latency

I'm using tcp sockets to provide interprocess communication between two apps on Windows XP. I chose tcp sockets for various reasons. I'm seeing an average round-trip time of 2.8 ms. That's much slower than I was expecting. Profiling seems to show that the delay is between one app calling send and the other end's blocking recv returning. ...

Bluetooth creates socket but blocks at connect() ANDROID

I am using code from the Google Bluetooth Chat Example to set up a bluetooth listening server. I want the app to listen always for an incoming connection. When the app sees a connection request it will accept the connection, read in the string that the remote device will send, and then respond by sending a file. The problem is that th...

Larger File Sizes are being incorrectly transfered with a NetworkStream

I am transferring a file over a NetworkStream and it seems that when the file goes over about 5-10k, the file starts to miss out on data and/or have huge whitespace gaps. Here is what I have: private string ReadandSaveFileFromServer(TcpClient clientATF, NetworkStream currentStream, string locationToSave) { int fileSize = 0; st...

Does posix aio in linux 2.6 support socket file descriptor?

I've seached such question in google and got different answers.I cann't determine whether posix aio in linux 2.6 support socket file descriptor or not. if it support tcp socket,does the aiocb.aio_offset=0 relative to the first byte readed from the tcp socket fd? if it doesn't,does any asynchronous io library in linux support socket fd?...

Boost.Asio: Operation Cancelled on async_read

Another one in the continuing saga of myself vs. Boost.Asio... I have a simple asynchronous client and server that utilise async_write and async_read to communicate. The client can successfully write bytes to the socket, but the server never sees them; my read handler on the server fails with "Operation cancelled". I'm inclined to beli...

C++ network programing in linux: Server Questions

I am learning how to network program using c/c++ and I have created a server(TCP) that is suppose to respond in specific ways to messages from a client in order to do this I created a class that the server class passes the message to and returns a string to report back to the client. Here is my problem sometimes it reports the correct s...

Can I Send to Socket and receive from it in the same place in C

Hi all I have a dll written in C. I would like to send data to a socket and receive the answer in the same function. e.g.: BOOL SendToSocketAndRecv(...) { // ... send(...); retval = recv(...); // ... } In another word, my dll should not follow Client Server pattren. Is this possible ? any help ? Thank you - Kha...

Are there C++ versions of PHP's fsockopen, fread, fwrite, fclose?

Are there C++ versions of PHP's fsockopen, fread, fwrite, fclose or anything similar? I'm using Windows (MFC) and TCP if that changes anything. ...

Developing an RSS Feed Reader in C++

Hi, I wanna write a simple RSS Feed reader in C++. I understand that the basic requirement is to understand XML parsing ( at the low level), opening, reading/writing, closing sockets and stuff like that. I don't need help in coding for sure. But It would be great if someone can help in getting started with RSS Protocol. E.g.. How exactl...

problem in receiving UDP packets

Hi, I'm getting UDP packets from the port continuously. Following is the log from wireshark. How to receive those packets continuously using winsock programming. I tried but I can't able to receive. After recvfrom() call it is not writing into a buffer.Give me idea, how to receive each packet in a buffer and write each packet into to a ...

C# TCP Socket Programming - Determining whether a connection has been dropped

I am trying to discover whether a TCP connection is being dropped at the server after a given interval and have written the following code; var tcpClient = new TcpClient(); tcpClient.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.KeepAlive, true); tcpClient.Connect(Ip, Port); var status = tcpClient.Connected ? ...

Java's readInt() equivalent in C?

In one side I have a Java client writing ints into its outputstream: int a = 20; dataout.writeInt(a); dataout.flush(); From the other side I have a C server listening the connection: int client = accept(...); How to read the int sent by Java? If I had a Java server, i could easily write: int a = dataIn.readInt(); How to do this in C...

Java Socket Programming

i have a txt file with students name and marks for subjects. i send this file from client to server using Socket clientSocket = new Socket("127.0.0.1",5432); OutputStream os = clientSocket.getOutputStream(); os.write(clientWriteArr,0,clientWriteArr.length); and read this file at server using ServerSocket sock ...

Network receipt timer to ms resolution

My scenario, I'm collecting network packets and if packets match a network filter I want to record the time difference between consecutive packets, this last part is the part that doesn't work. My problem is that I cant get accurate sub-second measurements no matter what C timer function I use. I've tried: gettimeofday(), clock_gettime...

How to read data from socket connection - android

I've got TCP client app which successfully negotiates connection to server and receives buffered output, but what I need to know is how to read server responses without waiting to buffer to fill out or server to end connection. In this loop: BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); String i...

Constipated Python urllib2 sockets

I've been scouring the Internet looking for a solution to my problem with Python. I'm trying to use a urllib2 connection to read a potentially endless stream of data from an HTTP server. It's part of some interactive communication, so it's important that I can get the data that's available, even if it's not a whole buffer full. There se...

C++ DGRAM socket get the RECEIVER address.

In C++, how can I get the receiver address of the UDP packet which I have received using recvfrom. I know that it should be the same host on which I am receiving the packet, but I need to extract it from the received packet, in order to verify something. How can I do this? I found that one way of doing this is: int r = getsockopt(r...

C++ UDP sockets packet queuing

I am using the same UDP socket for sending and receiving data. I am wondering if packet queuing for DGRAM sockets is already present, or do we have to handle it separately. If the user code has to handle queueing, how is it done? Do we have separate threads to recvfrom for the socket and put the packet in the reciver_queue and to sen...