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 ClientSocketStat and in SA TServerSocket's component ServerSocketStat to exchange information.
On ServerSocketStat's event OnGetSocket I initialize and start cStatThread's thread object ( class cStatThread is derived from TServerClientThread)
Expand|Select|Wrap|Line Numbers
- void __fastcall TForm1::ServerSocketStatGetSocket(TObject *Sender,
- int Socket, TServerClientWinSocket *&ClientSocket)
- {
- ClientSocketN=new TServerClientWinSocket(Socket,ServerSocketStat-> Socket;
- cStatThread* sthr=new cStatThread(true,ClientSocket);
- sthr->Resume();
- }
Expand|Select|Wrap|Line Numbers
- __fastcall cStatThread::cStatThread(bool CreateSuspended, TServerClientWinSocket* aSocket)
- : TServerClientThread(CreateSuspended,aSocket) {}
Expand|Select|Wrap|Line Numbers
- ...............
- TWinSocketStream* statStream;
- try{statStream=new TWinSocketStream(ClientSocket,5000);}
- //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)
- .................
But the most interesting that the same code in other application does'nt make any exceptions.