[Gambas-user] Network Programming
PICCORO McKAY Lenz
mckaygerhard at gmail.com
Tue May 18 16:59:18 CEST 2021
El mar, 18 de may. de 2021 a la(s) 10:44, John Dovey (dovey.john at gmail.com)
> On Tue, 18 May 2021 at 09:25, T Lee Davidson <t.lee.davidson at gmail.com>
>> The socket objects representing connections to unique clients are
>> contained in an array of objects (ie. the Clients object
>> array). When a connection request is received, a unique socket is created
>> with ServerSocket.Accept() and is added to the Clients
>> array (list?) with Clients.Add(); one socket per unique client. All the
>> sockets created are attached to the "Socket" event
>> observer. [http://gambaswiki.org/wiki/comp/gb.net/serversocket/accept]
>> When a message is received from a client, the Socket_Read() event handler
>> is triggered. Now, since we don't know exactly which
>> client sent the message, we can use the Last keyword which represents
>> whichever server socket received the current message from
>> its connected client. And since Last, in this case, is a handle on a
>> socket, all the properties and methods of Socket are
>> available to us (ie. Last.RemoteHost).
>> Thank you for the explanation. I'm going to have to step through my
> program in debug mode until I understand exactly what is happening and what
> information is stored where, because that's still not entirely clear to me.
is pretty difficult to understand but it seems managing client sockets is a
bit more elaborated, so we must iterate in all our connected clients using
LAST until we have all the required information right?
>> I'm not sure exactly what you mean by, "manage the full session with the
>> client." Isn't the function of a chat server to
>> basically forward a message sent by one client to all the other clients?
>> What management of individual clients would be necessary?
> I'm not quite sure what would be "necessary". That's what I'm trying to
> figure out. One aspect of where I'm heading is to have the server accept a
> remote connection, then spawn off a brand new form which will echo locally
> what is happening on the remote. The idea I have here, and I'm really
> stumbling in the dark, is I'd like to have a client-server setup where I
> can generate cairo commands on the server and send them to the remote
> client where they would be rendered. I want to also render them locally so
> that I can send (on the client's request) an SVG/PNG/PDF version of what's
> been rendered. I did something similar many years ago using Winsock
> connections, but there I had to maintain my own in-memory table of
> connections etc.
> To start with, I'd like to be able to just Telnet to the port I'm
> listening on, receive a text menu, and then send a menu choice and have the
> server respond depending on that choice. I'll figure it out eventually.
> Thanks again for all your help.
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User