Internet Modules
Kamaelia has a wide selection of components to allow you to implement TCP and UDP based systems, including Multicast capabilities and simple chassis or making servers. These are mostly found in Kamaelia.Internet.
These components implement the low level functionality for making and maintaining connections - they do not implement any particular network protocols. Other components do that and can be used with these to construct more capable servers and clients.
Making a TCP socket connection to a serverThe
TCPClient component simply makes a connection to a server. Its inboxes and outboxes receive and send data from/to that server. This is very easy to use.
TCPThreadedClient is identical to use, but differs in implementation. It run its own thread and so doesn't need the
Selector component)
Being a TCP socket serverSingleServer is the simplest kind of server to use - it allows one client to connect at a time, and its inbox and outbox communicate with that client.
ConnectedServer is more powerful - it can handle lots of clients simultaneously. It is a kind of factor component: every time a client connects it spawns a component (known as the protocol handler) to deal with that connection.
ConnectedServer is built ontop of
TCPServer which provides the underlying handling of the socket connections. By spawning
ConnectedSocketAdapter components to manage the socket for each connection.
Sending and receiving UDP datagrams
The
Kamaelia.Internet.UDP module contains components for sending and receiving datarams.
MulticastThese components provide a simple way to send and receive (or both send and receive) multicast datagrams.
Network simulationThe
Kamaelia.Internet.Simulate module contains components that simulate the kinds of problems you might get on a network - out of order packet delivery, lost packets etc.
Supporting components
ConnectedSocketAdapter
(CSA) components are spawned by the TCP client and server components to
look after actual communication with the TCP socket.
Kamaelia.Chassis.Selector
is designed for dealing with checking to see if any network connections
are active, and notifying CSAs
that they can send/receive data. This allows individual CSAs to pause
when idle - without having to block up the system or waste processor
cycles by constantly polling.
If you are just using the facilities provided for implementing clients
and server you don't need to worry about these components!
-- Matt Hammond, April 2007
(C) 2005 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved,
This is an ongoing community based development site. As a result the
contents of this page is the opinions of the contributors of the pages
involved not the organisations involved. Specificially, this page
may contain personal views which are not the views of the BBC.