Would Like To Know How To Architect as Well Program Client/Server using CSocketFile for Transferring A "Case" Object
-
Dear Friends, I would like To Send my "Case" Object From One Client To Any Other Clients (whom I would Target To) Through My Server.The Server is to be Multithreaded.I would like to Use CSocketFile Class to make the Transfer from Client To Server And Then ,from Server To Other Client(s). I am Presenting My "Case" Class , to enable you to help me better.I would like to know which Classes I need To Build and where.I am very new to Socket Programming,I need the Architecture. Class CCase { protected: char CaseID[10]; char CaseName[20]; int ConsultationCount; public: char* GetCaseID(); void SetCaseID(char NewCaseID[10]); char* GetCaseName(); void SetCaseName(char NewCaseName[20]); int GetConsultationCount(); void SetConsultationCount(int NewConsultationCount); }; Also, Apart From the Above declarations,my Case Class Also Contains some objects (of Other Classes,I used) as members. Just Have A Look At My Code : ************************************************************* //Case.cpp IMPLEMENT_SERIAL (CCase,CObject,1) void CCase::Serialize(CArchive& ar) { CObject::Serialize (ar); if(ar.IsStoring ()) { ar.Read (this->CaseID ,20); ar.Read (this->CaseName,20); ar.Read ((void*)this->ConsultationCount,100) ; ar.Flush (); } else if(ar.IsLoading()) { ar.Write (this->CaseID,20 ); ar.Write(this->CaseName ,20); ar.Write ((void*)this->ConsultationCount,100 ); ar.Flush (); } } char* CCase::GetCaseID() { return this->CaseID ; } void CCase::SetCaseID(char NewCaseID[10]) { strcpy(this->CaseID ,NewCaseID); } char* CCase::GetCaseName() { return this->CaseName ; } void CCase::SetCaseName(char NewCaseName[20]) { strcpy(this->CaseName ,NewCaseName); } int CCase::GetConsultationCount() { return this->ConsultationCount ; } void CCase::SetConsultationCount(int NewConsultationCount) { this->ConsultationCount =NewConsultationCount; } CCase::~CCase() { } ************************************************************* //MyServer.cpp::InitInstance() : : : if (!ProcessShellCommand(cmdInfo)) return FALSE; CSocket ServerSocket; BOOL Created; BOOL ListenStatus; int nConnectionBacklog=5; BOOL AcceptClientRequestStatus; Created=ServerSocket.Create (20248,SOCK_STREAM,"200.200.200.44"); if(Created==FALSE) { AfxMessageBox("Could NOT Create ServerSocket!!!"); return FALSE; } AfxMes
-
Dear Friends, I would like To Send my "Case" Object From One Client To Any Other Clients (whom I would Target To) Through My Server.The Server is to be Multithreaded.I would like to Use CSocketFile Class to make the Transfer from Client To Server And Then ,from Server To Other Client(s). I am Presenting My "Case" Class , to enable you to help me better.I would like to know which Classes I need To Build and where.I am very new to Socket Programming,I need the Architecture. Class CCase { protected: char CaseID[10]; char CaseName[20]; int ConsultationCount; public: char* GetCaseID(); void SetCaseID(char NewCaseID[10]); char* GetCaseName(); void SetCaseName(char NewCaseName[20]); int GetConsultationCount(); void SetConsultationCount(int NewConsultationCount); }; Also, Apart From the Above declarations,my Case Class Also Contains some objects (of Other Classes,I used) as members. Just Have A Look At My Code : ************************************************************* //Case.cpp IMPLEMENT_SERIAL (CCase,CObject,1) void CCase::Serialize(CArchive& ar) { CObject::Serialize (ar); if(ar.IsStoring ()) { ar.Read (this->CaseID ,20); ar.Read (this->CaseName,20); ar.Read ((void*)this->ConsultationCount,100) ; ar.Flush (); } else if(ar.IsLoading()) { ar.Write (this->CaseID,20 ); ar.Write(this->CaseName ,20); ar.Write ((void*)this->ConsultationCount,100 ); ar.Flush (); } } char* CCase::GetCaseID() { return this->CaseID ; } void CCase::SetCaseID(char NewCaseID[10]) { strcpy(this->CaseID ,NewCaseID); } char* CCase::GetCaseName() { return this->CaseName ; } void CCase::SetCaseName(char NewCaseName[20]) { strcpy(this->CaseName ,NewCaseName); } int CCase::GetConsultationCount() { return this->ConsultationCount ; } void CCase::SetConsultationCount(int NewConsultationCount) { this->ConsultationCount =NewConsultationCount; } CCase::~CCase() { } ************************************************************* //MyServer.cpp::InitInstance() : : : if (!ProcessShellCommand(cmdInfo)) return FALSE; CSocket ServerSocket; BOOL Created; BOOL ListenStatus; int nConnectionBacklog=5; BOOL AcceptClientRequestStatus; Created=ServerSocket.Create (20248,SOCK_STREAM,"200.200.200.44"); if(Created==FALSE) { AfxMessageBox("Could NOT Create ServerSocket!!!"); return FALSE; } AfxMes
ummmm the only sockets we discuss in the lounge are the plug types for the tv and video machines and maybe a few table lamps *hint* ---> try the c++ forum ;P
situations to avoid #37:
"good morning ... how many sugars do you take in your coffee ... and what was your name again?"coming soon: situations to avoid #38: "...and the dog was there too?"
-
ummmm the only sockets we discuss in the lounge are the plug types for the tv and video machines and maybe a few table lamps *hint* ---> try the c++ forum ;P
situations to avoid #37:
"good morning ... how many sugars do you take in your coffee ... and what was your name again?"coming soon: situations to avoid #38: "...and the dog was there too?"
lauren wrote: the only sockets we discuss in the lounge are the plug types for the tv and video machines and maybe a few table lamps Heh, I was calling them thingies and whatsits, now I know the proper name :-) Regardz Colin J Davies
Sonork ID 100.9197:Colin
More about me :-)
-
Dear Friends, I would like To Send my "Case" Object From One Client To Any Other Clients (whom I would Target To) Through My Server.The Server is to be Multithreaded.I would like to Use CSocketFile Class to make the Transfer from Client To Server And Then ,from Server To Other Client(s). I am Presenting My "Case" Class , to enable you to help me better.I would like to know which Classes I need To Build and where.I am very new to Socket Programming,I need the Architecture. Class CCase { protected: char CaseID[10]; char CaseName[20]; int ConsultationCount; public: char* GetCaseID(); void SetCaseID(char NewCaseID[10]); char* GetCaseName(); void SetCaseName(char NewCaseName[20]); int GetConsultationCount(); void SetConsultationCount(int NewConsultationCount); }; Also, Apart From the Above declarations,my Case Class Also Contains some objects (of Other Classes,I used) as members. Just Have A Look At My Code : ************************************************************* //Case.cpp IMPLEMENT_SERIAL (CCase,CObject,1) void CCase::Serialize(CArchive& ar) { CObject::Serialize (ar); if(ar.IsStoring ()) { ar.Read (this->CaseID ,20); ar.Read (this->CaseName,20); ar.Read ((void*)this->ConsultationCount,100) ; ar.Flush (); } else if(ar.IsLoading()) { ar.Write (this->CaseID,20 ); ar.Write(this->CaseName ,20); ar.Write ((void*)this->ConsultationCount,100 ); ar.Flush (); } } char* CCase::GetCaseID() { return this->CaseID ; } void CCase::SetCaseID(char NewCaseID[10]) { strcpy(this->CaseID ,NewCaseID); } char* CCase::GetCaseName() { return this->CaseName ; } void CCase::SetCaseName(char NewCaseName[20]) { strcpy(this->CaseName ,NewCaseName); } int CCase::GetConsultationCount() { return this->ConsultationCount ; } void CCase::SetConsultationCount(int NewConsultationCount) { this->ConsultationCount =NewConsultationCount; } CCase::~CCase() { } ************************************************************* //MyServer.cpp::InitInstance() : : : if (!ProcessShellCommand(cmdInfo)) return FALSE; CSocket ServerSocket; BOOL Created; BOOL ListenStatus; int nConnectionBacklog=5; BOOL AcceptClientRequestStatus; Created=ServerSocket.Create (20248,SOCK_STREAM,"200.200.200.44"); if(Created==FALSE) { AfxMessageBox("Could NOT Create ServerSocket!!!"); return FALSE; } AfxMes
You forgot to #include "intherightforum.h" Crivo Automated Credit Assessment
-
lauren wrote: the only sockets we discuss in the lounge are the plug types for the tv and video machines and maybe a few table lamps Heh, I was calling them thingies and whatsits, now I know the proper name :-) Regardz Colin J Davies
Sonork ID 100.9197:Colin
More about me :-)
****Colin Davies wrote: Heh, I was calling them thingies and whatsits, now I know the proper name Yep, Thingies and whatsits, along with doodahs and whachamacallits are a different kettle of fish Paresh Solanki There is no substitute for genuine lack of preparation.