libtcp++

libtcp++ is a C++ class library to facilitate the creation of TCP/IP clients and servers.
Download

libtcp++ Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Price:
  • FREE
  • Publisher Name:
  • Sasha Pachev
  • Publisher web site:
  • http://www.asksasha.com/download.html

libtcp++ Tags


libtcp++ Description

libtcp++ is a C++ class library to facilitate the creation of TCP/IP clients and servers. libtcp++ is a C++ class library to facilitate the creation of TCP/IP clients and servers. libtcp++ has three classes, TcpClient, TcpServer and TcpIpRuleSet.TcpServer has build it logging capability peer detection method, and IP-based access control in addition to regular server functionality.TcpClient supports a user specified timeout on connect(), nice for port/host scanning, and other situations when you may be connecting to a dead host or a firewalled port.Requirements:· a C++ compiler on a Unix platform with STL support to the exent of GCC 2.7, · a reasonably recent version GCC itself is the best compiler to compile it on.· The library will cleanly compile on Linux and BSD with g++. Other configurations have not yet been tested. You may need to change a few lines to make it work on another platform/compiler. Please let me know what you did to make it work in that case.Installation: gunzip -c libtcp++*.tar.gz | tar xvf - cd libtcp++-* ./configure make su make installUsage: #include #include to link use -ltcp++The use of the client should be pretty obvious from the header file and the test example in tcp_client.ccThe same applies to the server (see tcp_server.cc ), but one thing requires explanation:to write your own server, inherit from TcpServer and implement handle_client(int sock_fd)the server will listen on the port specified in the constructor and fork when connection is made calling your implementation of handle_client() see source for more detailsTo use IP access control, after instantiating TcpServer call add_ip_rule(netnum, netmask) of each rule. Use netmask of 255.255.255.255 for a single host, and its IP for netnum. Both netnum and netmask are C string representations of IP addresses/masks, not the 4-byte arrays. They will be parsed by inet_aton().After setting up all the rules with add_ip_rule(), activate them with enable_access_control(). After you have called enable_access_control() all connections will be denied except those coming from host that match one of the rules you have added. You can disable it with disable_access_control()


libtcp++ Related Software