Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
Implementing Peer-to-Peer Functionality
The LEADTOOLS Peer-to-Peer features provide Peer-to-Peer functions that allow you to create client server applications that transfer data over the Internet or local intranets. The first step to implementing network capabilities is to initialize the LEADTOOLS Peer-to-Peer DLL using LInet::StartUp. All of the LEADTOOLS Peer-to-Peer functions require that a network connection be established. You can connect to a remote computer using LInet::Connect. This generates a call to LInet::OnConnectRequest on the server. You can setup a local computer to act as a server and listen for incoming connection requests using LInet::ServerInit. If your application is acting as a server, it can accept connection requests using LInet::AcceptConnect. This generates a call to LInet::OnConnect on the client. You can determine who is connected to your server using LInet::GetHostname. To close an open network connection or to shutdown a local server, use LInet::Close.
While a network connection is open, you can:
1. Transfer data and sound between local and remote computers.
2. Send commands and responses between a local and a remote computer.
The LInet class provides users the functionality to retrieve any remote computer connected to the user's computer, either client or server, through the LInet class internal list. To get an LInet class pointer for a remote computer use LInet::GetItem by passing the index of the desired computer or its handle. You can: get the next remote computer by calling LInet::GetNextItem, get the prevoius remote computer by calling LInet::GetPrevItem, get the last remote computer in the connection list by calling LInet::GetLastItem, and get the first remote computer by calling LInet::GetFirstItem. In addition, you can view the list of the connections by calling LInet::CreateWnd and expanding or collapsing the window (since the window is a tree view control), using LInet::ExpandWnd. Items may be added to the window by calling LInet::AddWndItem, or removed from the window using LInet::RemoveWndItem. To determine whether an item is in the window, call LInet::IsWndItem.