Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Would Like To Know How To Architect as Well Program Client/Server using CSocketFile for Transferring A "Case" Object

Would Like To Know How To Architect as Well Program Client/Server using CSocketFile for Transferring A "Case" Object

Scheduled Pinned Locked Moved The Lounge
c++sysadminarchitecturehelptutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    G V Bhaskar
    wrote on last edited by
    #1

    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

    L D 2 Replies Last reply
    0
    • G G V Bhaskar

      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

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      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?"

      C 1 Reply Last reply
      0
      • L l a u r e n

        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?"

        C Offline
        C Offline
        ColinDavies
        wrote on last edited by
        #3

        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 :-)

        P 1 Reply Last reply
        0
        • G G V Bhaskar

          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

          D Offline
          D Offline
          Daniel Turini
          wrote on last edited by
          #4

          You forgot to #include "intherightforum.h" Crivo Automated Credit Assessment

          1 Reply Last reply
          0
          • C ColinDavies

            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 :-)

            P Offline
            P Offline
            Paresh Solanki
            wrote on last edited by
            #5

            ****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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups