The Artima Developer Community
Sponsored Link

Java Buzz Forum
Joost: A Simple Networking Library

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Joost: A Simple Networking Library Posted: Jun 27, 2006 1:11 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Joost: A Simple Networking Library
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

Today's OCI C++ lunch features Justin Michel presenting his own networking library—Joost. It abstracts away many of the lower level details and makes network programming simple and correct. The Joost abstraction retains only a few concepts: addresses, connections, events, messages. Hook them up and you've got a little thingy that will do the right things with little programmer attention. Things are done in an asynchronous fashion and nothing blocks. Flow control are handled through events.

The interfaces are carefully designed to make efficient implementations possible on multiple platforms and across programming languages. .NET and Java implementations have been done. C++ implementation is in progress.

Here's a snippet of client code:

class hello_client : public joost::tcp_events {
//...
public:
  void run() {
    joost::ip_address addr("localhost", 5555);
    joost::message_size_decoder_ptr no_msd;
    joost::tcp_events_ptr handler(this, dont_delete);
    joost::tcp_connection con(addr, no_msd, handler);

    std::string hello = "Hello World";
    joost::out_message out;
    out.append_uint8(hello.size() + 1); // size of string + 1 byte header
    out.append_ascii(hello);

    std::cout << "\nSending Hello..." << std::endl;
    joost::tcp_send_results result = con.send(out);

    std::cout << "\nDisconnection..." << std::endl;
    con.disconnect();
    hman.wait();
    std::cout << "\nDone." << std::endl;
  }

// ...
};

Read: Joost: A Simple Networking Library

Topic: Weird Al Javavic: Java EE 5 Previous Topic   Next Topic Topic: Flickr: Kim

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use