|
||
Client programs access TCP/IP sockets through the generic socket
interface RSocket
, specifying protocol-specific behaviour through
argument values. This section contains notes on the particular usage of
RSocket
functions for TCP and UDP sockets. It does not repeat the
information contained in the documentation for RSocket
, to which
you should always refer first.
RSocket
takes a number of parameters which identify what kind of socket connection to provide. The important parameters for TCP/IP
or UDP are the addrFamily
, the sockType
and the protocol
. The following constant values should be used for TCP/IP.
addrFamily: KAfInet
or KAfInet6
for IPv6
sockType: KSockStream
(for TCP/IP) or KSockDatagram
for UDP
protocol: KProtocolInetTCP
or KProtocolInetUDP
void Example::open(void)
{
TInt err;
RSocketServ ss;
RSocket sock;
err = ss.Connect();
err = sock.Open(ss, KAfInet, KSockStream, KProtocolInetTcp);
// ... now connect to the socket to send and receive data