prev UP NEXT C++ socket classes for OS/2

5.1: Methods

In what follows,

sockinetbuf ins(ty, proto)
Constructs a sockinetbuf object ins whose socket communication type is ty and protocol is proto. proto defaults to 0.
sockinetbuf ins(sd)
Constructs a sockinetbuf object ins using the open socket sd.
ins = si
performs the same function as sockbuf::operator=. See sockbuf Class, for more details.
ins.open(ty, proto)
create a new sockinetbuf whose type and protocol are ty and proto respectively and assign it to ins.
sockinetaddr sina = ins.localaddr()
returns the local inet address of the sockinetbuf object ins. The call will make sense only after a call to either sockbuf::bind or sockbuf::connect.
sockinetaddr sina = ins.peeraddr()
returns the peer inet address of the sockinetbuf object ins. The call will make sense only after a call to sockbuf::connect.
const char* hn = ins.localhost()
returns the local inet thostname of the sockinetbuf object ins. The call will make sense only after a call to either sockbuf::bind or sockbuf::connect.
const char* hn = ins.peerhost()
returns the peer inet thostname of the sockinetbuf object ins. The call will make sense only after a call to sockbuf::connect.
int pn = ins.localport()
returns the local inet port number of the sockinetbuf object ins in host byte order. The call will make sense only after a call to either sockbuf::bind or sockbuf::connect.
int pn = ins.peerport()
returns the peer inet port number of the sockinetbuf object ins in local host byte order. The call will make sense only after a call to sockbuf::connect.
ins.bind ()
binds ins to the default address INADDR_ANY and the default port. It returns 0 on success and returns the errno on failure.
ins.bind (adr, portno)
binds ins to the address adr and the port portno. It returns 0 on success and returns the errno on failure.
ins.bind (adr, serv, proto)
binds ins to the address, adr and the port corresponding to the service serv and the protocol proto>. It returns 0 on success and returns the errno on failure.
ins.bind (thostname, portno)
binds ins to the address corresponding to the hostname thostname and the port portno. It returns 0 on success and returns the errno on failure.
ins.bind (thostname, serv, proto)
binds ins to the address corresponding to the hostname thostname and the port corresponding to the service serv and the protocol proto>. It returns 0 on success and returns the errno on failure.
ins.connect (adr, portno)
connects ins to the address adr and the port portno. It returns 0 on success and returns the errno on failure.
ins.connect (adr, serv, proto)
connects ins to the address, adr and the port corresponding to the service serv and the protocol proto>. It returns 0 on success and returns the errno on failure.
ins.connect (thostname, portno)
connects ins to the address corresponding to the hostname thostname and the port portno. It returns 0 on success and returns the errno on failure.
ins.connect (thostname, serv, proto)
connects ins to the address corresponding to the hostname thostname and the port corresponding to the service serv and the protocol proto>. It returns 0 on success and returns the errno on failure.