]>
git.saurik.com Git - wxWidgets.git/blob - src/unix/gsocket.c
4157d89baaf28eeb49805c141b90c357641c3030
1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Purpose: GSocket main Unix file
6 * -------------------------------------------------------------------------
14 #include <sys/ioctl.h>
15 #include <sys/types.h>
19 #include <sys/socket.h>
23 #include <netinet/in.h>
24 #include <arpa/inet.h>
35 # include <sys/filio.h>
44 #include "wx/gsocket.h"
51 # define SOCKLEN_T socklen_t
54 # define SOCKLEN_T int
59 /* Global initialisers */
66 void GSocket_Cleanup()
70 /* Constructors / Destructors */
72 GSocket
*GSocket_new()
77 socket
= (GSocket
*)malloc(sizeof(GSocket
));
80 for (i
=0;i
<GSOCK_MAX_EVENT
;i
++) {
81 socket
->m_fbacks
[i
] = NULL
;
82 socket
->m_iocalls
[i
] = FALSE
;
84 socket
->m_local
= NULL
;
85 socket
->m_peer
= NULL
;
86 socket
->m_error
= GSOCK_NOERROR
;
87 socket
->m_server
= FALSE
;
88 socket
->m_stream
= TRUE
;
89 socket
->m_gui_dependent
= NULL
;
90 socket
->m_blocking
= FALSE
;
92 /* We initialize the GUI specific entries here */
93 _GSocket_GUI_Init(socket
);
98 void GSocket_destroy(GSocket
*socket
)
100 assert(socket
!= NULL
);
102 /* First, we check that the socket is really shutdowned */
103 if (socket
->m_fd
!= -1)
104 GSocket_Shutdown(socket
);
106 /* We destroy GUI specific variables */
107 _GSocket_GUI_Destroy(socket
);
109 /* We destroy private addresses */
111 GAddress_destroy(socket
->m_local
);
114 GAddress_destroy(socket
->m_peer
);
116 /* We destroy socket itself */
120 void GSocket_Shutdown(GSocket
*socket
)
124 assert(socket
!= NULL
);
126 /* If socket has been created, we shutdown it */
127 if (socket
->m_fd
!= -1) {
128 shutdown(socket
->m_fd
, 2);
133 /* We also disable GUI callbacks */
134 for (evt
=0;evt
<GSOCK_MAX_EVENT
;evt
++)
135 _GSocket_Uninstall_Fallback(socket
, evt
);
138 /* Address handling */
140 GSocketError
GSocket_SetLocal(GSocket
*socket
, GAddress
*address
)
142 assert(socket
!= NULL
);
144 if ((socket
->m_fd
!= -1 && !socket
->m_server
)) {
145 socket
->m_error
= GSOCK_INVSOCK
;
146 return GSOCK_INVSOCK
;
149 if (address
== NULL
|| address
->m_family
== GSOCK_NOFAMILY
) {
150 socket
->m_error
= GSOCK_INVADDR
;
151 return GSOCK_INVADDR
;
155 GAddress_destroy(socket
->m_local
);
157 socket
->m_local
= GAddress_copy(address
);
159 return GSOCK_NOERROR
;
162 GSocketError
GSocket_SetPeer(GSocket
*socket
, GAddress
*address
)
164 assert(socket
!= NULL
);
166 if (address
== NULL
|| address
->m_family
== GSOCK_NOFAMILY
) {
167 socket
->m_error
= GSOCK_INVADDR
;
168 return GSOCK_INVADDR
;
172 GAddress_destroy(socket
->m_peer
);
174 socket
->m_peer
= GAddress_copy(address
);
176 return GSOCK_NOERROR
;
179 GAddress
*GSocket_GetLocal(GSocket
*socket
)
182 struct sockaddr addr
;
185 assert(socket
!= NULL
);
188 return GAddress_copy(socket
->m_local
);
190 if (socket
->m_fd
== -1) {
191 socket
->m_error
= GSOCK_INVSOCK
;
197 if (getsockname(socket
->m_fd
, &addr
, &size
) < 0) {
198 socket
->m_error
= GSOCK_IOERR
;
202 address
= GAddress_new();
203 _GAddress_translate_from(address
, &addr
, size
);
208 GAddress
*GSocket_GetPeer(GSocket
*socket
)
210 assert(socket
!= NULL
);
213 return GAddress_copy(socket
->m_peer
);
218 /* Server specific parts */
221 GSocket_SetServer() setup the socket as a server. It uses the "Local" field
222 of GSocket. "Local" must be set by GSocket_SetLocal() before
223 GSocket_SetServer() is called. GSOCK_INVSOCK if socket has been initialized.
224 In case, you haven't yet defined the local address, it returns GSOCK_INVADDR.
225 In the other cases it returns GSOCK_IOERR.
227 GSocketError
GSocket_SetServer(GSocket
*sck
)
233 if (sck
->m_fd
!= -1) {
234 sck
->m_error
= GSOCK_INVSOCK
;
235 return GSOCK_INVSOCK
;
239 sck
->m_error
= GSOCK_INVADDR
;
240 return GSOCK_INVADDR
;
243 /* We always have a stream here */
244 sck
->m_stream
= TRUE
;
246 /* Create the socket */
247 sck
->m_fd
= socket(sck
->m_local
->m_realfamily
, SOCK_STREAM
, 0);
249 if (sck
->m_fd
== -1) {
250 sck
->m_error
= GSOCK_IOERR
;
254 /* Bind the socket to the LOCAL address */
255 if (bind(sck
->m_fd
, sck
->m_local
->m_addr
, sck
->m_local
->m_len
) < 0) {
258 sck
->m_error
= GSOCK_IOERR
;
262 /* Enable listening up to 5 connections */
263 if (listen(sck
->m_fd
, 5) < 0) {
266 sck
->m_error
= GSOCK_IOERR
;
270 return GSOCK_NOERROR
;
274 GSocket_WaitConnection() waits for an incoming client connection.
276 GSocket
*GSocket_WaitConnection(GSocket
*socket
)
280 assert(socket
!= NULL
);
282 /* If the socket has already been created, we exit immediately */
283 if (socket
->m_fd
== -1 || !socket
->m_server
) {
284 socket
->m_error
= GSOCK_INVSOCK
;
288 /* Reenable GSOCK_CONNECTION event */
289 _GSocket_Enable(socket
, GSOCK_CONNECTION
);
291 /* Create a GSocket object for the new connection */
292 connection
= GSocket_new();
294 /* Accept the incoming connection */
295 connection
->m_fd
= accept(socket
->m_fd
, NULL
, NULL
);
296 if (connection
->m_fd
== -1) {
297 GSocket_destroy(connection
);
298 socket
->m_error
= GSOCK_IOERR
;
302 /* Initialize all fields */
303 connection
->m_stream
= TRUE
;
304 connection
->m_server
= FALSE
;
305 connection
->m_oriented
= TRUE
;
310 /* Non oriented connections */
312 GSocketError
GSocket_SetNonOriented(GSocket
*sck
)
316 if (sck
->m_fd
!= -1) {
317 sck
->m_error
= GSOCK_INVSOCK
;
318 return GSOCK_INVSOCK
;
322 sck
->m_error
= GSOCK_INVADDR
;
323 return GSOCK_INVADDR
;
326 sck
->m_stream
= FALSE
;
327 sck
->m_server
= FALSE
;
328 sck
->m_oriented
= FALSE
;
330 /* Create the socket */
331 sck
->m_fd
= socket(sck
->m_local
->m_realfamily
, SOCK_DGRAM
, 0);
333 /* Bind it to the LOCAL address */
334 if (bind(sck
->m_fd
, sck
->m_local
->m_addr
, sck
->m_local
->m_len
) < 0) {
337 sck
->m_error
= GSOCK_IOERR
;
341 return GSOCK_NOERROR
;
344 /* Client specific parts */
347 GSocket_Connect() establishes a client connection to a server using the "Peer"
348 field of GSocket. "Peer" must be set by GSocket_SetPeer() before
349 GSocket_Connect() is called. In the other case, it returns GSOCK_INVADDR.
351 GSocketError
GSocket_Connect(GSocket
*sck
, GSocketStream stream
)
357 if (sck
->m_fd
!= -1) {
358 sck
->m_error
= GSOCK_INVSOCK
;
359 return GSOCK_INVSOCK
;
363 sck
->m_error
= GSOCK_INVADDR
;
364 return GSOCK_INVADDR
;
367 /* Test whether we want the socket to be a stream (e.g. TCP) */
368 sck
->m_stream
= (stream
== GSOCK_STREAMED
);
369 sck
->m_oriented
= TRUE
;
376 /* Create the socket */
377 sck
->m_fd
= socket(sck
->m_peer
->m_realfamily
, type
, 0);
379 if (sck
->m_fd
== -1) {
380 sck
->m_error
= GSOCK_IOERR
;
384 /* Connect it to the PEER address */
385 if (connect(sck
->m_fd
, sck
->m_peer
->m_addr
,
386 sck
->m_peer
->m_len
) != 0) {
389 sck
->m_error
= GSOCK_IOERR
;
393 /* It is not a server */
394 sck
->m_server
= FALSE
;
396 return GSOCK_NOERROR
;
401 /* Like recv(), send(), ... */
402 int GSocket_Read(GSocket
*socket
, char *buffer
, int size
)
404 assert(socket
!= NULL
);
406 if (socket
->m_fd
== -1 || socket
->m_server
) {
407 socket
->m_error
= GSOCK_INVSOCK
;
411 /* Reenable GSOCK_INPUT event */
412 _GSocket_Enable(socket
, GSOCK_INPUT
);
414 if (socket
->m_stream
)
415 return _GSocket_Recv_Stream(socket
, buffer
, size
);
417 return _GSocket_Recv_Dgram(socket
, buffer
, size
);
420 int GSocket_Write(GSocket
*socket
, const char *buffer
,
423 assert(socket
!= NULL
);
425 if (socket
->m_fd
== -1 || socket
->m_server
) {
426 socket
->m_error
= GSOCK_INVSOCK
;
430 _GSocket_Enable(socket
, GSOCK_OUTPUT
);
432 if (socket
->m_stream
)
433 return _GSocket_Send_Stream(socket
, buffer
, size
);
435 return _GSocket_Send_Dgram(socket
, buffer
, size
);
438 bool GSocket_DataAvailable(GSocket
*socket
)
443 assert(socket
!= NULL
);
445 if (socket
->m_fd
== -1 || socket
->m_server
) {
446 socket
->m_error
= GSOCK_INVSOCK
;
451 FD_SET(socket
->m_fd
, &read_set
);
456 select(socket
->m_fd
+1, &read_set
, NULL
, NULL
, &tv
);
458 return FD_ISSET(socket
->m_fd
, &read_set
);
464 GSocket_SetBlocking() puts the socket in non-blocking mode. This is useful
465 if we don't want to wait.
467 void GSocket_SetBlocking(GSocket
*socket
, bool block
)
469 assert(socket
!= NULL
);
471 socket
->m_blocking
= block
;
473 if (socket
->m_fd
!= -1)
474 ioctl(socket
->m_fd
, FIONBIO
, &block
);
478 GSocket_GetError() returns the last error occured on the socket stream.
481 GSocketError
GSocket_GetError(GSocket
*socket
)
483 assert(socket
!= NULL
);
485 return socket
->m_error
;
491 Only one fallback is possible for each event (INPUT, OUTPUT, CONNECTION)
492 INPUT: The function is called when there is at least a byte in the
494 OUTPUT: The function is called when the system is sure the next write call
496 CONNECTION: Two cases is possible:
497 Client socket -> the connection is established
498 Server socket -> a client request a connection
499 LOST: the connection is lost
501 SetFallback accepts a combination of these flags so a same callback can
502 receive different events.
504 An event is generated only once and its state is reseted when the relative
505 IO call is requested.
506 For example: INPUT -> GSocket_Read()
507 CONNECTION -> GSocket_Accept()
509 void GSocket_SetFallback(GSocket
*socket
, GSocketEventFlags event
,
510 GSocketFallback fallback
, char *cdata
)
514 assert (socket
!= NULL
);
516 for (count
=0;count
<GSOCK_MAX_EVENT
;count
++) {
517 /* We test each flag and, if it is enabled, we enable the corresponding
519 if ((event
& (1 << count
)) != 0) {
520 socket
->m_fbacks
[count
] = fallback
;
521 socket
->m_data
[count
] = cdata
;
523 _GSocket_Install_Fallback(socket
, count
);
524 _GSocket_Enable(socket
, count
);
530 UnsetFallback will disables all fallbacks specified by "event".
531 NOTE: event may be a combination of flags
533 void GSocket_UnsetFallback(GSocket
*socket
, GSocketEventFlags event
)
537 assert(socket
!= NULL
);
539 for (count
=0;count
<GSOCK_MAX_EVENT
;count
++) {
540 if ((event
& (1 << count
)) != 0) {
541 _GSocket_Disable(socket
, count
);
542 socket
->m_fbacks
[count
] = NULL
;
543 _GSocket_Uninstall_Fallback(socket
, count
);
548 #define CALL_FALLBACK(socket, event) \
549 if (socket->m_iocalls[event] && \
550 socket->m_fbacks[event]) {\
551 _GSocket_Disable(socket, event); \
552 socket->m_fbacks[event](socket, event, \
553 socket->m_data[event]); \
556 #define MASK_SIGNAL() \
558 void (*old_handler)(int); \
560 old_handler = signal(SIGPIPE, SIG_IGN);
562 #define UNMASK_SIGNAL() \
563 signal(SIGPIPE, old_handler); \
566 void _GSocket_Enable(GSocket
*socket
, GSocketEvent event
)
568 socket
->m_iocalls
[event
] = TRUE
;
569 if (socket
->m_fbacks
[event
])
570 _GSocket_Install_Fallback(socket
, event
);
573 void _GSocket_Disable(GSocket
*socket
, GSocketEvent event
)
575 socket
->m_iocalls
[event
] = FALSE
;
576 if (socket
->m_fbacks
[event
])
577 _GSocket_Uninstall_Fallback(socket
, event
);
580 int _GSocket_Recv_Stream(GSocket
*socket
, char *buffer
, int size
)
585 ret
= recv(socket
->m_fd
, buffer
, size
, 0);
588 socket
->m_error
= GSOCK_IOERR
;
594 int _GSocket_Recv_Dgram(GSocket
*socket
, char *buffer
, int size
)
596 struct sockaddr from
;
600 fromlen
= sizeof(from
);
603 ret
= recvfrom(socket
->m_fd
, buffer
, size
, 0, &from
, &fromlen
);
606 socket
->m_error
= GSOCK_IOERR
;
610 /* Translate a system address into a GSocket address */
612 socket
->m_peer
= GAddress_new();
613 _GAddress_translate_from(socket
->m_peer
, &from
, fromlen
);
618 int _GSocket_Send_Stream(GSocket
*socket
, const char *buffer
, int size
)
623 ret
= send(socket
->m_fd
, buffer
, size
, 0);
626 socket
->m_error
= GSOCK_IOERR
;
632 int _GSocket_Send_Dgram(GSocket
*socket
, const char *buffer
, int size
)
634 struct sockaddr
*addr
;
637 if (!socket
->m_peer
) {
638 socket
->m_error
= GSOCK_INVADDR
;
642 _GAddress_translate_to(socket
->m_peer
, &addr
, &len
);
645 ret
= sendto(socket
->m_fd
, buffer
, size
, 0, addr
, len
);
648 socket
->m_error
= GSOCK_IOERR
;
652 /* Frees memory allocated from _GAddress_translate_to */
658 void _GSocket_Detected_Read(GSocket
*socket
)
663 if (socket
->m_stream
) {
664 ret
= recv(socket
->m_fd
, &c
, 1, MSG_PEEK
);
666 if (ret
< 0 && socket
->m_server
) {
667 CALL_FALLBACK(socket
, GSOCK_CONNECTION
);
672 CALL_FALLBACK(socket
, GSOCK_INPUT
);
674 CALL_FALLBACK(socket
, GSOCK_LOST
);
679 void _GSocket_Detected_Write(GSocket
*socket
)
681 CALL_FALLBACK(socket
, GSOCK_OUTPUT
);
689 * -------------------------------------------------------------------------
691 * -------------------------------------------------------------------------
694 /* CHECK_ADDRESS verifies that the current family is either GSOCK_NOFAMILY or
695 * GSOCK_*family*. In case it is GSOCK_NOFAMILY, it initializes address to be
696 * a GSOCK_*family*. In other cases, it returns GSOCK_INVADDR.
698 #define CHECK_ADDRESS(address, family, retval) \
700 if (address->m_family == GSOCK_NOFAMILY) \
701 _GAddress_Init_##family(address); \
702 if (address->m_family != GSOCK_##family) {\
703 address->m_error = GSOCK_INVADDR; \
708 GAddress
*GAddress_new()
712 address
= (GAddress
*)malloc(sizeof(GAddress
));
714 address
->m_family
= GSOCK_NOFAMILY
;
715 address
->m_addr
= NULL
;
721 GAddress
*GAddress_copy(GAddress
*address
)
725 assert(address
!= NULL
);
727 addr2
= (GAddress
*)malloc(sizeof(GAddress
));
728 memcpy(addr2
, address
, sizeof(GAddress
));
730 if (address
->m_addr
) {
731 addr2
->m_addr
= (struct sockaddr
*)malloc(addr2
->m_len
);
732 memcpy(addr2
->m_addr
, address
->m_addr
, addr2
->m_len
);
738 void GAddress_destroy(GAddress
*address
)
740 assert(address
!= NULL
);
745 void GAddress_SetFamily(GAddress
*address
, GAddressType type
)
747 assert(address
!= NULL
);
749 address
->m_family
= type
;
752 GAddressType
GAddress_GetFamily(GAddress
*address
)
754 assert(address
!= NULL
);
756 return address
->m_family
;
759 void _GAddress_translate_from(GAddress
*address
, struct sockaddr
*addr
, int len
){
760 address
->m_realfamily
= addr
->sa_family
;
761 switch (addr
->sa_family
) {
763 address
->m_family
= GSOCK_INET
;
766 address
->m_family
= GSOCK_UNIX
;
770 address
->m_family
= GSOCK_INET6
;
780 free(address
->m_addr
);
782 address
->m_len
= len
;
783 address
->m_addr
= (struct sockaddr
*)malloc(len
);
784 memcpy(address
->m_addr
, addr
, len
);
787 void _GAddress_translate_to(GAddress
*address
,
788 struct sockaddr
**addr
, int *len
)
790 if (!address
->m_addr
) {
795 *len
= address
->m_len
;
796 *addr
= (struct sockaddr
*)malloc(address
->m_len
);
797 memcpy(*addr
, address
->m_addr
, address
->m_len
);
801 * -------------------------------------------------------------------------
802 * Internet address family
803 * -------------------------------------------------------------------------
806 void _GAddress_Init_INET(GAddress
*address
)
808 address
->m_len
= sizeof(struct sockaddr_in
);
809 address
->m_addr
= (struct sockaddr
*)malloc(address
->m_len
);
810 address
->m_family
= GSOCK_INET
;
811 address
->m_realfamily
= PF_INET
;
812 ((struct sockaddr_in
*)address
->m_addr
)->sin_family
= AF_INET
;
813 ((struct sockaddr_in
*)address
->m_addr
)->sin_addr
.s_addr
= INADDR_ANY
;
816 GSocketError
GAddress_INET_SetHostName(GAddress
*address
, const char *hostname
)
819 struct in_addr
*addr
;
821 assert(address
!= NULL
);
823 CHECK_ADDRESS(address
, INET
, GSOCK_INVADDR
);
825 addr
= &(((struct sockaddr_in
*)address
->m_addr
)->sin_addr
);
827 /* If it is a numeric host name, convert it now */
828 if (inet_aton(hostname
, addr
) == 0) {
829 struct in_addr
*array_addr
;
831 /* It is a real name, we solve it */
832 if ((he
= gethostbyname(hostname
)) == NULL
) {
833 address
->m_error
= GSOCK_NOHOST
;
836 array_addr
= (struct in_addr
*) *(he
->h_addr_list
);
837 addr
->s_addr
= array_addr
[0].s_addr
;
839 return GSOCK_NOERROR
;
842 GSocketError
GAddress_INET_SetHostAddress(GAddress
*address
,
843 unsigned long hostaddr
)
845 struct in_addr
*addr
;
847 assert(address
!= NULL
);
849 CHECK_ADDRESS(address
, INET
, GSOCK_INVADDR
);
851 addr
= &(((struct sockaddr_in
*)address
->m_addr
)->sin_addr
);
852 addr
->s_addr
= hostaddr
;
854 return GSOCK_NOERROR
;
857 GSocketError
GAddress_INET_SetPortName(GAddress
*address
, const char *port
,
858 const char *protocol
)
861 struct sockaddr_in
*addr
;
863 assert(address
!= NULL
);
864 CHECK_ADDRESS(address
, INET
, GSOCK_INVADDR
);
867 address
->m_error
= GSOCK_INVPORT
;
871 se
= getservbyname(port
, protocol
);
873 if (isdigit(port
[0])) {
876 port_int
= atoi(port
);
877 addr
= (struct sockaddr_in
*)address
->m_addr
;
878 addr
->sin_port
= htons(port_int
);
879 return GSOCK_NOERROR
;
882 address
->m_error
= GSOCK_INVPORT
;
883 return GSOCK_INVPORT
;
886 addr
= (struct sockaddr_in
*)address
->m_addr
;
887 addr
->sin_port
= se
->s_port
;
889 return GSOCK_NOERROR
;
892 GSocketError
GAddress_INET_SetPort(GAddress
*address
, unsigned short port
)
894 struct sockaddr_in
*addr
;
896 assert(address
!= NULL
);
897 CHECK_ADDRESS(address
, INET
, GSOCK_INVADDR
);
899 addr
= (struct sockaddr_in
*)address
->m_addr
;
900 addr
->sin_port
= htons(port
);
902 return GSOCK_NOERROR
;
905 GSocketError
GAddress_INET_GetHostName(GAddress
*address
, char *hostname
, size_t sbuf
)
909 struct sockaddr_in
*addr
;
911 assert(address
!= NULL
);
912 CHECK_ADDRESS(address
, INET
, GSOCK_INVADDR
);
914 addr
= (struct sockaddr_in
*)address
->m_addr
;
915 addr_buf
= (char *)&(addr
->sin_addr
);
917 he
= gethostbyaddr(addr_buf
, sizeof(addr
->sin_addr
), AF_INET
);
919 address
->m_error
= GSOCK_NOHOST
;
923 strncpy(hostname
, he
->h_name
, sbuf
);
925 return GSOCK_NOERROR
;
928 unsigned long GAddress_INET_GetHostAddress(GAddress
*address
)
930 struct sockaddr_in
*addr
;
932 assert(address
!= NULL
);
933 CHECK_ADDRESS(address
, INET
, 0);
935 addr
= (struct sockaddr_in
*)address
->m_addr
;
937 return addr
->sin_addr
.s_addr
;
940 unsigned short GAddress_INET_GetPort(GAddress
*address
)
942 struct sockaddr_in
*addr
;
944 assert(address
!= NULL
);
945 CHECK_ADDRESS(address
, INET
, 0);
947 addr
= (struct sockaddr_in
*)address
->m_addr
;
948 return ntohs(addr
->sin_port
);
952 * -------------------------------------------------------------------------
953 * Unix address family
954 * -------------------------------------------------------------------------
957 void _GAddress_Init_UNIX(GAddress
*address
)
959 address
->m_len
= sizeof(struct sockaddr_un
);
960 address
->m_addr
= (struct sockaddr
*)malloc(address
->m_len
);
961 address
->m_family
= GSOCK_UNIX
;
962 address
->m_realfamily
= PF_UNIX
;
963 ((struct sockaddr_un
*)address
->m_addr
)->sun_family
= AF_UNIX
;
964 ((struct sockaddr_un
*)address
->m_addr
)->sun_path
[0] = 0;
967 GSocketError
GAddress_UNIX_SetPath(GAddress
*address
, const char *path
)
969 struct sockaddr_un
*addr
;
971 assert(address
!= NULL
);
973 CHECK_ADDRESS(address
, UNIX
, GSOCK_INVADDR
);
975 addr
= ((struct sockaddr_un
*)address
->m_addr
);
976 memcpy(addr
->sun_path
, path
, strlen(path
));
978 return GSOCK_NOERROR
;
981 GSocketError
GAddress_UNIX_GetPath(GAddress
*address
, char *path
, size_t sbuf
)
983 struct sockaddr_un
*addr
;
985 assert(address
!= NULL
);
986 CHECK_ADDRESS(address
, UNIX
, GSOCK_INVADDR
);
988 addr
= (struct sockaddr_un
*)address
->m_addr
;
990 strncpy(path
, addr
->sun_path
, sbuf
);
992 return GSOCK_NOERROR
;
995 #endif // wxUSE_SOCKETS