2 * (c) Oleg Puchinin 2006,2007
3 * graycardinalster@gmail.com
7 #ifndef DEFINE_DCONNECTION_H
8 #define DEFINE_DCONNECTION_H
17 /// Класс "соединение".
28 int bind (char *ip
, uint16_t port
);
29 int connect (char *ip
, uint16_t port
= 0);
30 int connectUdp (char *ip
, uint16_t port
);
32 Connection
* accept ();
33 int send (char * buf
, int len
);
34 int sendTo (char * buf
, int len
);
35 int recv (char * buf
, int len
);
36 int recvFrom (char *buf
, int len
, char * IP
, uint16_t * PORT
);
37 DUdp
* recvUdp (int bufLen
= 65535);
38 void updateCTime (time_t d_time
= 0);
39 void updateMTime (time_t d_time
= 0);
41 int select (int secs
, int usecs
);
42 Connection
* clone ();
44 int setSocket (int m_sd
, bool dirty
= true);
46 int setTimeOut (int t
);
50 void setName (char * m_name
);
51 void setGroup (char * m_group
);
52 void setRevents (int m_set
);
53 void setPollFlags (int m_set
);
55 int open (char *f_name
, int openmode
, int filemode
= 0644);
56 int read (char *m_buf
, int len
);
57 int write (char *m_buf
, int len
);
58 char * getsockname ();
59 char * getpeername ();
60 uint16_t getpeerport ();
61 uint16_t getsockport ();
73 Buf
* recv (int opts
= 0);
75 int send (Buf
*, int opts
= 0);
76 List
* recvStrings ();
77 int shutdown (int how
);
79 char * setUserData (char * ptr
);
91 char * c_cname
; // client address
92 char * c_pname
; // server address
95 char * c_status
; // other data