[Gambas-user] Network Programming

John Dovey dovey.john at gmail.com
Tue May 18 23:42:37 CEST 2021


On Tue, May 18, 2021 at 4:41 PM T Lee Davidson <t.lee.davidson at gmail.com>
wrote:

> .
>
> Just FYI, doing it that way breaks the principle of encapsulation. Suppose
> you change the variable name of the SocketServer in
> your Server class and forget to change it in your main Form. You then just
> created a bug for yourself.
>
> Perhaps consider creating a Close subroutine in your Server class the
> executes Srv.Close(). Then, you have only one file in
> which the variable name needs to be kept consistent. The call to Close in
> your main form would then be, simply, "Server.Close()".
>
Good idea

>
>
> > 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.
>
> You may wish to take a look at the ServerSocket example in the Gambas
> Farm. It uses the Socket's Tag property to keep track of
> data unique to each client and respond accordingly. Forms also have a Tag
> property. You might be able to use either Socket.Tag
> or Form.Tag to associate a socket with a form.
>
Another good idea. I’ll look for it.
Thanks again
John

>
>
> --
> Lee
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-- 
Sent from Gmail Mobile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210518/65ff4d01/attachment-0001.htm>


More information about the User mailing list