tcp

Indy Write Buffering / Efficient TCP communication

I know, I'm asking a lot of questions...but as a new delphi developer I keep falling over all these questions :) This one deals with TCP communication using indy 10. To make communication efficient, I code a client operation request as a single byte (in most scenarios followed by other data bytes of course, but in this case only one sin...

synchronize clocks over internet

I am sending real-time-critical data over the internet between two dedicated computers, using my own protocol. There is, of course, latency involved. For debugging and optimization, I like to have both computers use the same timebase. I.e, I need to know the time difference of their clocks so that I can judge the latencies better. Of ...

How to do TOS/DSCP in ruby?

How does one set the TOS flags/DSCP flags in Ruby on a UDP/TCP stream (preferably using the Ruby/Sockets library)? ...

WCF Service Deployment - Where Are the Application Files Kept?

I have a WCF service that calls, through a BL, a Data Layer and ultimately SQL Server back-end. My service exposes various methods/operations to get data out of the database. I have also built a host for it for testing, and a Windows Service Host, which is how I plan to deploy it. Yesterday when I did a test-deploy, the service starte...

tcp - getting num bytes acked

In standard tcp implementations (say, on bsd), does anybody know if it's possible to find out how many bytes have been ack-ed by the remote host? Calling write() on a socket returns the number of bytes written, but I believe this actually means the number of bytes that could fit into the tcp buffer (not the number of bytes written to th...

How many socket connections possible?

Has anyone an idea how many tcp-socket connections are possible on a modern standard root server? (There is in general less traffic on each connection, but all the connections have to be up all the time.) EDIT: We will use a Linux Server. ...

Could someone post a simple C or C++ TCP server and client example?

I need to quickly implement a very small C or C++ TCP server/client solution. This is simply to transfer literally an array of bytes from one computer to another - doesn't need to be scalable / over-complicated. The simpler the better. Quick and dirty if you can. I tried to use the code from this tutorial, but I couldn't get it to build...

How to create a HTTP request listener Windows Service in .NET

I want to create Windows Service that acts as a HTTP listener and can handle around 500 clients. Are there any special considerations for this kind of service. I am a little confused between the HTTPListener class and the TCPListener class. Which one to use for a Windows Service that will: Accept the client connection (around 500) Pr...

Is it better to send 1 large chunk or lots of small ones when using TCP?

After I accept() a connection, and then write() to the client socket, is it better to write all the data you intend to send at once or send it in chunks? For example: accept, write 1MB, disconnect …or… accept, write 256 bytes, write 256 bytes, … n, disconnect My gut feeling tells me that the underlying protocol does this aut...

What is the correct way of reading from a TCP socket in C/C++?

Here's my code: // Not all headers are relevant to the code snippet. #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <cstdlib> #include <cstring> #include <unistd.h> char *buffer; stringstream readStream; bool readData = true; while (readData) { cout << "Receiving ...

Java Socket : TCP Checksum Incorrect

I'm experimenting w/java sockets. I can connect to a socket and send/receive bytes of data w/o a problem. However I am also sniffing the traffic using wireshark and noticing each packet that comes from the java socket is marked by wireshark as "tcp checksum incorrect." Anyone have any insight? java version "1.6.0_12" Java(TM) SE Runtim...

Any good advice for TCP packet formatting?

I am creating an application for mobile phone which sends the acceleration measurements through TCP connection to the server. I would like to reduce the message length as much as possible but in the same time I would like to make it the current format possible to extend without a lot of pain on modifying receiver parsing mechanism. At ...

How do I send an array of integers over TCP in C?

I'm lead to believe that write() can only send data buffers of byte (i.e. signed char), so how do I send an array of long integers using the C write() function in the sys/socket.h library? Obviously I can't just cast or convert long to char, as any numbers over 127 would be malformed. I took a look at the question, how to decompose int...

Why do I get weird results when reading an array of integers from a TCP socket?

As was suggested in an answer to my last question (How do I send an array of integers over TCP in C?), I tried to send an array of long int, however I may be doing something to break the solution... #define ARRAY_LEN 4 /* I'm using long because the numbers are very large, * but in this example they're small to save space. */ long orig...

When sending an array of int over TCP, why are only the first amount correct?

Following my previous question (Why do I get weird results when reading an array of integers from a TCP socket?), I have come up with the following code, which seems to work, sort of. The code sample works well with a small number of array elements, but once it becomes large, the data is corrupt toward the end. This is the code to send ...

Performance of WCF with net.tcp

I have a WCF net.tcp service hosted with the builtin ServiceHost, and when doing some stress tests I get a strange behavior. The first time i send a bunch of requests, 5 to 10 requests are answered quickly, and the rest are returning at about 2 second intervals. The second time i send the requests, 10 - 20 are returned quickly, and rest ...

What is the correct way to read a MIME encoded stream?

I have a TCP socket with streaming MIME messages on it. I can use the JavaMail API to parse one MIME message at a time by searching for the boundary, then looking for the boundary + -- symbol. This seems like a lot of String manipulation. Someone out there has to have done MIME-encoded streaming correctly in Java. Where is it hiding? ...

TCP: How are the seq / ack numbers generated?

Greetings and salutations! I am currently working on a program which sniffs TCP packets being sent and received to and from a particular address. What I am trying to accomplish is replying with custom tailored packets to certain received packets. I've already got the parsing done. I can already generated valid Ethernet, IP, and--for the...

Why does TCP work, when UDP does not?

The code: <?php error_reporting(E_ALL); /* Allow the script to hang around waiting for connections. */ set_time_limit(0); /* Turn on implicit output flushing so we see what we're getting * as it comes in. */ ob_implicit_flush(); $address = '127.0.0.1'; $port = 11100; if (($sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UP)) === fals...

How many sockets can be created from a port?

How many sockets can be created from a port? ...