I've read a number of articles about UDP packet sizes but have been unable to come to a conclusion on whats correct.
A number of services restrict the largest UDP packet to 512 bytes (like dns)
Given the minimum MTU on the internet is 576 , and the size of the IPv4 header is 20 bytes, and the UDP header 8 bytes. This leaves 548 bytes...
Am I being dense here? StreamReader.ReadLine states that:
A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r") or a carriage return immediately followed by a line feed ("\r\n")
So, why doesn't this work as expected?
' Server
Dim tcpL as New TcpListener(IPAddress.Any, 5000)
tcpL.Sta...
Hello;
I am working on writing a network application in C++ on the Linux platform using the typical sockets API, and I am looking at 2 alternative ways of writing a byte array to a TCP stream: either by calling write(), or by calling send(). I know that, since this is Linux, the socket handle is simply a file descriptor, and therefore ...
For a TCP blocking socket, is it safe to call:
if(SOCKET_ERROR != recv(s, NULL, 0, 0))
//...
to detect errors?
I thought it was safe, then I had a situation on a computer that it was hanging on this statement. (was with an ssl socket if that matters). I also tried passing in the MSG_PEEK flag with a buffer specified but I also had...
I've written a simple application in Java where there are two nodes, each with a ServerSocket open to a port listening for incoming connections. The nodes run two threads each, sending 1000 messages to the other node through a persistent TCP socket created when sending the first message. However, the nodes do not receive all 1000 message...
Hi Everybody,
I'm suffering a lot to create a simple ChatServer in Java, using the NIO libraries. Wonder if someone could help me.
I am doing that by using SocketChannel and Selector to handle multiple clients in a single thread. The problem is: I am able to accept new connections and get it's data, but when I try to send data back, the...
Can someone point me to some tutorial on how to set up a ping method using C sockets? Using beej's guide, I've been able to set up a connection between two devices, but now I want to setup a method that pings for all available devices before starting an actual connection. I've never done this before, so would you do something like set up...
I have the following program to open lot's of sockets, and hold them open to stress test one of our servers. There are several problem's with this. I think it could be a lot more efficient than a recursive call, and it's really still opening sockets in a serial fashion rather than parallel fashion. I realize there are tools like ab th...
Does blocking mode put that particular task in a "Process Wait" state, as i think non-blocking sockets needs a "busy-wait" or "spin-lock" implementation, explicitly from the user. Or blocking mode sockets are nothing but implicit-implementations of busy-wait by the kernel.
In locking mechanisms like semaphores/mutexes/monitors a lock is...
I have a Java program (call it Jack) and an Objective-C program (call it Oscar), which I run on the same Mac OS X computer. Oscar sends a string message via a socket to Jack, once per second.
For reliability and performance would it be better to maintain an open socket between Jack and Oscar? Or would it be better to repeatedly open a ...
Is there any way to do this? I know java applets, flash don't allow this, what about browser plugins? Other ideas?
...
I'm writing a server in C# which creates a (long, possibly even infinite) IEnumerable<Result> in response to a client request, and then streams those results back to the client.
Can I set it up so that, if the client is reading slowly (or possibly not at all for a couple of seconds at a time), the server won't need a thread stalled wait...
Ok, I'm still new to using C sockets, but I was wondering if there is a way to extract the IP address adding running setsockopt? If you'll look at my code below, I have everything in my multicast sockets ready to send except for defining the variable mc_addr which is my IP address. Am I doing anything wrong that's real noticeable? If so,...
Hello,
I'm trying to send a string to a server application using C, but I've hit a snag. I'm fairly new to network programming, and I think my code is barking up the wrong tree.
The message is supposed to be message length + message and is unpacked on the other side by a python server as such (buf being the raw incoming data):
msg_len...
Hi,
I'm fighting with raw sockets in Win32 and now I'm stuck, the soetsockopt funtion give me the 10022 error (invalid argument), but I think I pass the correct arguments... of course I'm wrong u_u'
sock = socket(AF_INET,SOCK_RAW,IPPROTO_UDP);
if (sock == SOCKET_ERROR)
{
printf("Error socket(): %d", WSAGetLastError());
return;
}
ch...
I copied the following script and run it to have it listen on port 80. But netstat doesn't show port 80. Why does netstat not sow it, or the Perl script is not correct?
#!/usr/bin/perl -w
use Socket;
use IO::Handle;
$port=80;
$host='localhost';
$packhost=inet_aton($host);
$address=sockaddr_in($port,$packhost);
socket(SERVER,AF_I...
I'm writing a simple tcp server application using sockets. As far as I know I can obtain the client's ip address and port after calling accept().
Now lets assume I have a banlist and I want to ban some ip addresses from my server. Is there a better way than accepting the connection and then dropping it?
Is there a way to get the clien...
I have some simple PHP code that creates a SSL connection
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $this->sslPem);
stream_context_set_option($streamContext, 'ssl', 'passphrase', $this->passPhrase);
$this->apnsConnection = stream_socket_client('ssl://'.$this->apnsHost.':'.$...
I am writing an application to test a network driver for handling corrupted data. And I thought of sending this data using raw socket, so it will not be corrected by the sending machine's TCP-IP stack.
I am writing this application solely on Linux. I have code examples of using raw sockets in system-calls, but I would really like to kee...
Hello All,
I am pretty new to socket programming. I have a function call similar to:
len = read(FD, buf, 1500);
[which is responsible for reading data from a telnet connection]
a printf in the next line shows buf to be >300 characters in length but (int)len gives only 89! Because of this all further parsing of the returned string fa...