2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
21 * @brief This is the header file for the %Sockets namespace.
23 * This header file contains the declarations and descriptions of the %Sockets namespace.
26 #ifndef _FNET_SOCKETS_H_
27 #define _FNET_SOCKETS_H_
29 #include <FNetSockSocket.h>
30 #include <FNetSockISocketEventListener.h>
31 #include <FNetSockSecureSocket.h>
32 #include <FNetSockISecureSocketEventListener.h>
33 #include <FNetSockSocketIpMulticastRequestOption.h>
34 #include <FNetSockSocketLingerOption.h>
35 #include <FNetSockSocketUtility.h>
36 #include <FNetSockSocketTypes.h>
38 namespace Tizen { namespace Net
41 * @namespace Tizen::Net::Sockets
42 * @brief This namespace contains the classes and interfaces for Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) socket
46 * @remarks @b Header @b %file: @b \#include @b <FNet.h> @n
47 * @b Library : @b osp-net @n
49 * The %Tizen::Net::Sockets sub-namespace implements the socket data communication protocols by providing a rich set of methods for connecting,
50 * sending, and receiving data over a network.
52 * For more information on the %Sockets namespace features, see <a href="../org.tizen.native.appprogramming/html/guide/net/sockets.htm">Sockets Guide</a>.
54 * The following diagram illustrates the relationships between the classes belonging to the %Sockets namespace.
55 * @image html net_socket_using_the_apis_classdiagram.png
57 * The following example demonstrates how to use a TCP client non-blocking socket.
60 * result res = E_SUCCESS;
62 * // Creates the socket.
63 * Socket* pClientSocket = new Socket();
64 * res = pClientSocket->Construct(NET_SOCKET_AF_IPV4, NET_SOCKET_TYPE_STREAM, NET_SOCKET_PROTOCOL_TCP);
67 * MySocketClientListener* pSockClientListener = new MySocketClientListener();
68 * res = pClientSocket->AddSocketListener(*pSockClientListener);
70 * // Selects asynchronous event (non-blocking mode).
71 * res = pClientSocket->AsyncSelectByListener(NET_SOCKET_EVENT_CONNECT| NET_SOCKET_EVENT_CLOSE);
73 * // Creates peer endpoint.
74 * Ip4Address peerAddr("XXX.XXX.XXX.XXX"); // Server socket address.
75 * unsigned short peerPort = YYY; // Port
76 * NetEndPoint* pPeerEndPoint = new NetEndPoint(peerAddr, peerPort);
78 * // Connects the socket.
79 * res = pClientSocket->Connect(*pPeerEndPoint);
84 } } } // Tizen::Net::Sockets
85 #endif // _FNET_SOCKETS_H_