The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

socketio.h

Go to the documentation of this file.
00001 /*
00002 --------------------------------------------------------------
00003 Copyright (C)2000-2001 Center for Spoken Language Research,
00004                        University of colorado at Boulder
00005 --------------------------------------------------------------
00006 Class        : CClientSocket
00007 Created Date : October 16,2001
00008 --------------------------------------------------------------
00009 */
00010 #ifndef _CLIENT_SOCKET_H_MPUTIL_
00011 #define _CLIENT_SOCKET_H_MPUTIL_
00012 #pragma warning(disable:4786)
00013 
00014 #include <windows.h>
00015 #include <winsock.h>
00016 
00017 #include "../mputil.h"
00018 
00019 
00020 class MPUTIL::CClientSocket 
00021 {
00022 private:
00023         BOOL _isConnect;
00024         BOOL isConvert;
00025         SOCKET clientSock;
00026         sockaddr_in cin;
00027         char hostName[40];
00028         int hostPort;
00029         union INT_DATA {
00030                 int data;
00031                 char byte[4];
00032         }int_data;
00033         union FLOAT_DATA {
00034                 float data;
00035                 char byte[4];
00036         }float_data;
00037         union LONG_DATA{
00038                 long data;
00039                 char byte[4];
00040         }long_data;
00041         union DOUBLE_DATE{
00042                 double data;
00043                 char byte[4];
00044         }double_data;
00045         void writeConvert(char byte[],int numWrite);
00046         int readConvert(char byte[],int numRead);
00047 public:
00048         CClientSocket(char _hostName[],int _hostPort,BOOL _isConvert=FALSE);
00049         virtual ~CClientSocket();
00050         BOOL connectServer();
00051         BOOL isConnect();
00052         void disconnectServer();
00053         void writeByte(char i);
00054         void writeInt(int i);
00055         void writeLong(long l);
00056         void writeChar(char ch);
00057         void writeString(char *ch);
00058         void writeFloat(float f);
00059         void writeDouble(double d);
00060         char   readByte();
00061         int    readInt();
00062         long   readLong();
00063         float  readFloat();
00064         double readDouble();
00065         char   readChar();
00066         int    readFull(char bur[],int numRead);
00067 };
00068 
00069 
00070 #endif _CLIENT_SOCKET_H_MPUTIL_

Generated on Mon Nov 8 17:07:52 2004 for MPT by  doxygen 1.3.9.1