I'm currently searching for a Java networking library. What I want to do is sending XML, JSON or other serialized messages from a client to another client and/or client to server.
My first attempt was to create an POJO for each message, plus a MessageWriter for sending and a MessageReader for receiving it. Plus socket and error handling. Which is quite a lot of error prone work.
What I'm looking for is a a higher level library which abstracts from sockets. Furthermore it should supports something like code generation for the messages.
Google's Protocol Buffers (http://code.google.com/apis/protocolbuffers/) looks promising. But are there alternatives? The emphasis is not on speed or security (at the moment), it is just supposed to work reliable and with a low amount of implementation time.
Java is the first programming language designed from the ground up with networking in mind. As the global Internet continues to grow, Java is uniquely suited to build the next generation of network applications.
The java.net package provides support for the two common network protocols − TCP − TCP stands for Transmission Control Protocol, which allows for reliable communication between two applications. TCP is typically used over the Internet Protocol, which is referred to as TCP/IP.
The sockets which are reserved by specific protocols for communication are reserved sockets. Once the connection is ready a higher-level protocol is in use. This is dependent on the port which you are using. TCP/IP uses or reserves the lower 1024 ports for specific protocols.
The Network library makes it possible to read and write data across machines on the Internet. It allows the creation clients and servers. A server connects to a list of clients for reading and writing data. A client is able to read and write data to a server.
You have several options depending on how abstracted from raw sockets you want to get. Once you depart from socket level programming, you're pretty much into remoting territory,
I am not completely sure what you mean by code generation for the messages. Can you elaborate ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With