1 /***************************************************************************
2 * Copyright (C) 2005 by Dimitris Saougos & Filippos Papadopoulos *
3 * <psybases@gmail.com> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU Library General Public License as *
7 * published by the Free Software Foundation; either version 2 of the *
8 * License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU Library General Public *
16 * License along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
25 #include <sys/socket.h>
26 #include <netinet/in.h>
27 #include <arpa/inet.h>
46 struct sockaddr_in peer;
53 sd - a socket descriptor */
57 type - can be *AM_TCP* or *AM_UDP*
60 Socket(int type, int protocol);
69 Socket * Accept(void);
73 int Send(void *buffer, unsigned long size);
75 int Receive(void *buffer, unsigned long size);
77 int SendTo(void *buffer, unsigned long size);
79 int RecvFrom(void *buffer, unsigned long size);
81 int Select(unsigned long seconds, unsigned long microsecs);
83 int Select(unsigned long microsecs);
85 void SetPeer(struct sockaddr_in data);
87 struct sockaddr_in GetPeer(void);
88 /*method: CreatePeer */
89 struct sockaddr_in CreatePeer(const char *address, int port);
100 /*constructor: Network */
104 /*method: getSocket*/
105 Socket * getSocket(int type, int protocol);