?? client.h
字號:
/* a C++ socket server class Keith Vertanen 11/98 */#define BUFFSIZE 64000#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <sys/types.h>#include <netinet/in.h>#include <netdb.h>#include <sys/socket.h>#include <sys/wait.h>class Client{ // class attibutes public: int port; // the port I'm listening on int dataport; // port I listen for datagrams on (can be same or different from port) int REVERSE; protected: int new_fd; // new connection on new_fd int datasockfd; int senddatasockfd; struct sockaddr_in their_addr; // connector's address information struct sockaddr_in my_addr; // my address information struct hostent *he; double buffer[BUFFSIZE]; // reuse the same memory for buffer double buffer2[BUFFSIZE]; // class methods public: Client(int, int, char *host, int); // constructor void closesocket(); // close the socket void send_string(char *str); // send a string to socket void send_ints(int *vals, int len); // send some integers void send_bytes(char *vals, int len); // send some bytes void send_floats(float *vals, int len); // send some floats void send_doubles(double *vals, int len); // send some doubles void send_datagram(char *vals, int len); // send a datagram int recv_string(char *str, int max, char term); // recv a string int recv_ints(int *vals, int max); // recv ints int recv_floats(float *vals, int max); // recv floats int recv_doubles(double *vals, int max); // recv doubles int recv_bytes(char *vals, int max); // recv bytes int recv_datagram(char *vals, int len); // recv a datagram private: void recv_ack(); void send_ack();};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -