[netty-users] Netty and UDP (looking for help with UDP)
Trustin Lee
tlee at redhat.com
Tue Nov 11 00:54:01 EST 2008
Hi Imagenesis,
Netty doesn't support UDP yet at this moment unfortunately, and I think
your question is not related with Netty IMHO.
On Mon, Nov 10, 2008 at 11:28:51AM +0900, imagenesis wrote:
>
> 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;
> }
>
>
>
--
Trustin Lee, Principal Software Engineer, JBoss, a division of Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20081111/5fa670e6/attachment.bin
More information about the netty-users
mailing list