user499054
user499054

Reputation:

Basic Asyncronous TCP server in Java

I'm trying to create a very basic asynchronous server in Java (similar to http://msdn.microsoft.com/en-us/library/fx6588te.aspx in C#). All of the libraries I've seen for Java are way too complex for what I need and I'm wondering if there are any libraries that are simple and have a syntax similar to the C# example.

Edit: Why does plain sockets require root access to listen on the loopback, but nio doesn't require root?

Upvotes: 0

Views: 2343

Answers (2)

irreputable
irreputable

Reputation: 45433

try AsynchronousServerSocketChannel & AsynchronousSocketChannel

Upvotes: 2

Matt Ball
Matt Ball

Reputation: 359816

This sounds like a job for Java's NIO (New I/O) ServerSocketChannel.

Be forewarned, though: this doesn't guarantee better performance. See:

Upvotes: 1

Related Questions