meta data for this page
This page tries to clarify what happens when application/service uses peerhood interface to create a connection:
Our client (and its numbers function) will behave as an example.
In numbers function a list of devices is askes by using
apeerhood→GetDeviceLitL() command. From this list a device is selected. (maybe here we should show only those devices that are capable for the servcie). When the selection is doen then a connection is formend by using command
apeerhood→connect(device, service). This command tries to connect to the given service at the given device.
Connect(device,service) is defined and implemented in the PeerHoodImpl.cc file. This function looks for the services in the given device and if the requested service is found a new private function
Connect(proto, address, port, service, name checksum is called.
Connect(proto, address, port, service, name checksum
This function is private function of the PeerHoodImpl class. This function creates
CThreadInfo data form and calls
VirtulaConnection(proto, ThreadInfo) function. This
VirtulaConnection(proto, ThreadInfo) function takes care that a suitable connection is created (
Factory::CreateConnectionL(proto)). Then connection is connected through funtion
VirtualConnection→Connect(address, port). This Connect uses the Connect command of the selected proto.
'(NOTE this uses the given port number to set the connection WHAT means that if we really register services with port numbers we NEED to use them as well)'. After connection is Ok
VirtualConnection→Write(command) function is used. After this Write of the command PeerHood writes the service name it wants to use by using
VirtualConnection→Write(servicename). After that response is waited by using
VirtualConnection→Read(command) function. If we get PH_OK then
VirtualConnection→Write(connectionid) is used for sending the connectionid to the other end.
'There's something wrong with the connection id settings as first iConnectionId = 0. Then it is set to ThreadInfo. This same is sent to the other side and finally this value is increased.'