🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4314

Re: TCustomWinSocket Lock()!!!

#4314
From: qyte
Date: Sat, 05 Mar 2005 11:07
74 lines
3449 bytes
Hans Galema wrote:
> qyte wrote:
> 
> Please do not quote a whole reply. Just some lines will do.
> 
>> Let's say that i have four TClientSockets And 1 TServerSocket;
> 
> 
> In one application ? Or one server application and four client
> applications ?
> 
>  > During
> 
>> their OnConnect events i have declared the following:
>> TCustomWinSocket *sock[4];
> 
> 
> Are you doing that both for a TClientSocket AND a TServerSocket ?
> If so, why ?
> 
>> In The Server sock[ActiveConnections-1]=Socket;
> 
> 
> Please tell when you execute that statement. ActiveConnections
> often does not contain the right amount immediately.
> 
>> and in each client i assosciate them like sock[0]=Socket...
> 
> 
> I do not understand why a client has to bother with other
> clients.
> 
>> Because I Know the order in which they connect.
> 
> 
> Even if you know that. Never trust the Connections[] array
> for keeping that sequence.
> 
>> how can i be certain that when i call sock[0]->SendBuf No other can 
>> read(mainly) or write at the same time. It is abvious that they are 
>> all using the same port. 
> 
> 
> Please explain first what should happen. It looks as if you
> have a TServerSocket and upon connection of a client you use
> a TClientSocket to communicate with that client ?
> 
> That would be a strange construction.
> 
> Hans.



on the server on connect i send back an int to start the connection of 
the second client and so on. This works perfectly good. I have no 
problem with the assignments. the server socket read functions is the 
following and that works good as well. don't doubt about that.

{
         if(Socket==sock[0])
                 ClientSocketRead(ServerSocket,sock[0]);
         if(Socket==sock[1])
                 ClientSocket_s2Read(ServerSocket,sock[1]);
         if(Socket==sock[2])
                 ClientSocket_s1Read(ServerSocket,sock[2]);
         if(Socket==sock[3])
                 ClientSocket_mRead(ServerSocket,sock[3]);
}

just sometimes when i send data from both sides and responce is expected 
then there is confusion and they both stop transmiting. I don't know how 
could this be since sock[1] sends and sock[2] receives. when sock[1] 
receives above it considers only specific actions such as abort etc. 
That happens extremely Rarely.
Technical Details
Message-ID: <42299308@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.freenet.de!easynews.net!easynet-isham!easynet.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4228f8c1$1@newsgroups.borland.com> <42290e8b$1@newsgroups.borland.com> <42297c51$1@newsgroups.borland.com> <42298b47$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9c76e7cb52ebcfdd
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sat, 05 Mar 2005 13:07:51 +0200
From: qyte <gyte@vivodinet.gr>
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: TCustomWinSocket Lock()!!!
References: <4228f8c1$1@newsgroups.borland.com> <42290e8b$1@newsgroups.borland.com> <42297c51$1@newsgroups.borland.com> <42298b47$1@newsgroups.borland.com>
In-Reply-To: <42298b47$1@newsgroups.borland.com>
Content-Type: text/plain; charset=windows-1253; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 83.171.210.195
Message-ID: <42299308@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1110020872 83.171.210.195 (5 Mar 2005 03:07:52 -0800)
Lines: 74
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.freenet.de!easynews.net!easynet-isham!easynet.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail