🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Blocking Client

#4533
From: Hans Galema
Date: Thu, 20 Jan 2005 20:52
41 lines
2399 bytes
mike wrote:
> I have been trying to figure out how to properly write a blocking client
> application and have some basic questions.
> 
> 1- Is there an example around that I could study to see how this is done.

You can start at:
http://bdn.borland.com/article/0,1410,26276,00.html
It is a blocking TServerSocket and a non-blocking TClientSocket.
You can use the blocking code for the server for the client too.
Be sure to read the "Add or View comments" at the bottom of that page.

> 2- From what I have read I seem to understand the following, but I am not
> sure if I am correct or not.
> 
> - Set the Client Socket to Blocking.

ClientType ctBlocking

> - Once I have established a connect to the server, create my own thread that
> will do my reading of any data being received. I do this using the
> WinSocketStream and the method WaitForData()
> - from this thread then process the message.

You have to consider the type of client that you gonna
make. Wil the server only send data to the client after a request from the
client ?

Does your client application do other things then just communicating
with a server?

> 3- For writing to the socket, do I need to have a separate thread.

No.

> I am a little confused on how to put all this together so if someone has a
> sample or could help me lay it out  it sure would help.

Please have a look first.

Hans.
Technical Details
Message-ID: <41f01a60@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41f00ec6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,8975bc0a9ed70a81
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 20 Jan 2005 21:52:52 +0100
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: Blocking Client
References: <41f00ec6$1@newsgroups.borland.com>
In-Reply-To: <41f00ec6$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <41f01a60@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1106254432 129.125.201.248 (20 Jan 2005 12:53:52 -0800)
Lines: 41
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail