Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages
Started by OKusmen
Mon, 28 Nov 2005 14:38
Winsock error
Author: OKusmen
Date: Mon, 28 Nov 2005 14:38
Date: Mon, 28 Nov 2005 14:38
7 lines
1180 bytes
1180 bytes
"an operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full (10055), on API 'connect'" I see this error message in my application log. I can't find a solution for this. How can I solve this problem. Thanks for help.
Re: Winsock error
Author: Remy Lebeau (TeamB)
Date: Tue, 29 Nov 2005 05:18
Date: Tue, 29 Nov 2005 05:18
15 lines
1498 bytes
1498 bytes
"OKusmen" <okusmen@aselsan.com.tr> wrote in message news:438b17b9@newsgroups.borland.com... > I see this error message in my application log. I can't find > a solution for this. How can I solve this problem. Are you attempting to reconnect over and over? Calling connect() repeatedly, such a in a loop until the connnection finally succeeds, without fully cleaning up the socket in between, can cause that error. Where exactly are you getting the error from? Can you show the actual code? Gambit
Re: Winsock error
Author: Okusmen
Date: Thu, 01 Dec 2005 09:06
Date: Thu, 01 Dec 2005 09:06
80 lines
3266 bytes
3266 bytes
My application is a message server.So that, application connects to many clients.
TClientSocket is used for this operation in the server. In my client application has
a server socket. Socket no 50101. When message server wants to connect a closed client,
retry three times to connect.
void __fastcall TTCPSendDataModule::OnOperationalTimer(TObject */*Sender*/)
{
DisableTimer(OperationalTimer);
try
{
if( !ackWaiting && !connectionWaiting && !SendSocket->Active )// no connection request applied and no data feedback waiting
{
SendPacketInOrder();
}
}catch(const Exception &e){
}
EnableTimer(OperationalTimer);
}
//-----------------------------------------------
void __fastcall TTCPSendDataModule::SendPacketInOrder()
{
CloseSendSocket();
SendSocket->Port = 0;
SendSocket->Host = "";
SendSocket->Address = "";
SendSocket->Address = ip_address;
try{
SendSocket->Open();
}catch(const Exception &e){
CloseSendSocket();
}
}
//---------------------------------------------------------------------------
void TTCPSendDataModule::CloseSendSocket()
{
try{
SendSocket->Close();
SendSocket->Port = 0;
SendSocket->Active = false;
WriteToLog("TCP G�nderme Mod�l�: Socket kapat�ld�.");
}catch(const Exception &e)
{
WriteToLog("TCP Send Module Error4.Hata="+e.Message);
}
}
//---------------------------------------------------------------------------
void __fastcall TTCPSendDataModule::SendSocketError(TObject */*Sender*/,
TCustomWinSocket */*Socket*/, TErrorEvent /*ErrorEvent*/, int &ErrorCode)
{
try
{
ErrorCode = 0;
CloseSendSocket();
}catch(const Exception &e){
}
}
//---------------------------------------------------------------------------
// Socket Connect event
//---------------------------------------------------------------------------
void __fastcall TTCPSendDataModule::SendSocketConnect(TObject */*Sender*/,
TCustomWinSocket */*Socket*/)
{
try
{
SendFirstPacket();
}catch(const Exception &e){
}
}
After sending packet, I wait hig-level ack packet from client application. After receiving ack packet,
closesendsocket function is called.And then, another client transmission is started
Re: Winsock error
Author: Remy Lebeau (TeamB)
Date: Thu, 01 Dec 2005 18:39
Date: Thu, 01 Dec 2005 18:39
38 lines
2041 bytes
2041 bytes
"Okusmen" <okusmen@aselsan.com.tr> wrote in message
news:438ecb2f$1@newsgroups.borland.com...
> try{
> SendSocket->Open();
> }catch(const Exception &e){
> CloseSendSocket();
> }
That won't always work. When Open() throws an exception, it can leave the
socket in an indeterminate state that Close() does not fully recover from.
You would be better off just freeing the TClientSocket object and then
reinstantiate it. That ensures that all resources are fully released.
> SendSocket->Close();
> SendSocket->Port = 0;
> SendSocket->Active = false;
Why are you closing the socket twice?
> void __fastcall TTCPSendDataModule::SendSocketError(TObject */*Sender*/,
> TCustomWinSocket */*Socket*/, TErrorEvent /*ErrorEvent*/, int
&ErrorCode)
> {
> try
> {
> ErrorCode = 0;
> CloseSendSocket();
> }catch(const Exception &e){
> }
> }
You should be caling Close() on the Socket parameter, not the TClientSocket
object directly.
Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads