simple-socket library 1.2.0
InternetSocket.h
Go to the documentation of this file.
1#ifndef NET_InternetSocket_h__
2#define NET_InternetSocket_h__
3
4#include "SimpleSocket.h"
5
6struct sockaddr_in;
7
8namespace NET
9{
11
19 {
20 public:
22
34 void connect( std::string_view foreignAddress, unsigned short foreignPort);
35
37
45 int timedConnect( std::string_view foreignAddress, unsigned short foreignPort, int timeout);
46
52 void bind( unsigned short localPort = 0);
53
55
74 void bind( std::string_view localAddress, unsigned short localPort = 0);
75
81 std::string getLocalAddress() const;
82
88 unsigned short getLocalPort() const;
89
95 std::string getForeignAddress() const;
96
102 unsigned short getForeignPort() const;
103
104 protected:
106 explicit InternetSocket( int sockfd);
107
109 InternetSocket( int type, int protocol);
110
121 static void fillAddress( std::string_view address, unsigned short port, sockaddr_in& addr);
122 };
123
124} // namespace NET
125
126#endif // NET_InternetSocket_h__
Definition CANFrame.h:7
void bind(unsigned short localPort=0)
unsigned short getLocalPort() const
unsigned short getForeignPort() const
InternetSocket(int sockfd)
create socket from a SocketHandle returned by an accept() call
int timedConnect(std::string_view foreignAddress, unsigned short foreignPort, int timeout)
establish a connection with the given foreign address and port
void connect(std::string_view foreignAddress, unsigned short foreignPort)
establish a connection with the given foreign address and port
std::string getLocalAddress() const
std::string getForeignAddress() const
static void fillAddress(std::string_view address, unsigned short port, sockaddr_in &addr)
SimpleSocket(int sockfd)
enables return of an accepted socket