[netty-users] Netty and UDP (looking for help with UDP)
imagenesis
imagenesis at gmail.com
Sun Nov 9 21:28:51 EST 2008
Okay, so I started writing my app and then checked out the Quake engine and
all the big real time games are apparently using the UDP protocol.
Personally, I don't see all that much point in the header of the protocol
since the protocol is simply the header but w/e.
Anyway, I have a few questions and this seems like a good place to ask since
you guys probably know a lot about networking. I'm just trying to be
standards compliant... so here goes.
1) Does it matter what checksum algorithm we use for the checksum? What
would you recommend. Since it's not really for security what would be the
fastest?
2) I've looked at both the RFC and the wikipedia entry and some basic
implementation in Perl but I can't figure out what the actual syntax is.
Specifically what characters(s) do use for the message terminations and what
do use for the seperation of the values in the header (\0, \n?)?
Here is some C++ code that the wikipedia entry uses as an example for the
client? How the hell is this an implementation of UDP again? Where is the
checksum being sent? Where is the the size of the message being sent?
Granted my C++ is pretty much non-existant, but still it doesn't make much
sense. Thanks!
int main()
{
// Initiate use of the WinSock DLL.
WSADATA wsaData = { 0 };
WSAStartup( MAKEWORD( 2, 2 ), &wsaData );
// Create a socket and store the handle to it.
SOCKET hSocket = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
// Set the protocol, port, and address information of the server.
sockaddr_in serverAddr = { 0 };
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons( 2345 );
serverAddr.sin_addr.s_addr = inet_addr( "127.0.0.1" );
// Send a message to the server
char buffer[] = "hello";
sendto( hSocket, buffer, sizeof( buffer ) + 1, 0,
reinterpret_cast<sockaddr *>( &serverAddr ), sizeof( serverAddr ) );
// Cleanup.
WSACleanup();
return 0;
}
--
View this message in context: http://n2.nabble.com/Netty-and-UDP-%28looking-for-help-with-UDP%29-tp1479137p1479137.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list