🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TCustomWinSocket Lock()!!!

#4311
From: qyte
Date: Sat, 05 Mar 2005 09:30
60 lines
2860 bytes
Remy Lebeau (TeamB) wrote:
> "qyte" <gyte@vivodinet.gr> wrote in message
> news:4228f8c1$1@newsgroups.borland.com...
> 
> 
>>Does anyone know what exactly should i call lock
>>and unlock functions for?
> 
> 
> Nothing.  They are called automatically by the TCustomWinSocket internally.
> 
> 
>>will they work on non-blocking mode?
> 
> 
> Yes.
> 
> 
>>if there are 4 Sockets using the same port
> 
> 
> Using in what way?  Bound to locally, or connecting to remotely?
> 
> 
>>and i use Lock on the first will the others be able to use the Port for
> 
> reading and writing?
> 
> Lock() and Unlock() only affect the socket they are called on.  They are
> used to provide thread-safe access to the socket so that multiple threads do
> not try to all read from, or all write to, the socket at the same time.
> 
> 
> Gambit
> 

Let's say that i have four TClientSockets And 1 TServerSocket; During 
their OnConnect events i have declared the following:
TCustomWinSocket *sock[4];

In The Server sock[ActiveConnections-1]=Socket;

and in each client i assosciate them like sock[0]=Socket...
Because I Know the order in which they connect.

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. Is Their any way of Doing Such A Thing? The Sockets 
Are connected as follows.

Server----Client
sock[0]<->sock[0]
sock[1]<->sock[2]
sock[2]<->sock[1]
sock[3]<->sock[3]

even though sock[1] sends only and sock[2] receives only sometimes their 
is confusion when sock[1]->sendbuf is called from both the server and 
the client and they stuck. i made that way believing that they would be 
independent but even now they aren't. Do you know what i can do>
Technical Details
Message-ID: <42297c51$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!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>

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 11:30:56 +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>
In-Reply-To: <42290e8b$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: <42297c51$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1110015057 83.171.210.195 (5 Mar 2005 01:30:57 -0800)
Lines: 60
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail