Failed to create TWinSocketStream object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sanYAua007
    New Member
    • Oct 2007
    • 6

    Failed to create TWinSocketStream object

    Please, help me to solve such a problem:

    I'm writing server-application (SA) and client-application (CA) in C++ Builder 6 under Windows OS.

    In CA I'm using TClientSocket's component ClientSocketSta t and in SA TServerSocket's component ServerSocketSta t to exchange information.

    On ServerSocketSta t's event OnGetSocket I initialize and start cStatThread's thread object ( class cStatThread is derived from TServerClientTh read)

    Code:
    void __fastcall TForm1::ServerSocketStatGetSocket(TObject *Sender,
          int Socket, TServerClientWinSocket *&ClientSocket)
    {
    
        ClientSocketN=new TServerClientWinSocket(Socket,ServerSocketStat-> Socket;
          cStatThread* sthr=new cStatThread(true,ClientSocket);
          sthr->Resume();
    }
    This is cStatThread's constructor:
    Code:
    __fastcall cStatThread::cStatThread(bool CreateSuspended, TServerClientWinSocket* aSocket)
       : TServerClientThread(CreateSuspended,aSocket) {}
    This is cStatThread's ClientExecute method:
    Code:
    ...............
    TWinSocketStream* statStream;
        try{statStream=new TWinSocketStream(ClientSocket,5000);}
    //[B]after this line I receive Exception Message "Socket must be in blocking mode". But either ServerStatSocket or ClientStatSocket are in blocking modes 
    (stThreadBlocking and ctBlocking)[/B]
    .................
    Maybe I've forgot something?
    But the most interesting that the same code in other application does'nt make any exceptions.
Working...