[Gambas-devel] Re : Socket components

Benoit Minisini gambas at ...20...
Sat Aug 23 20:45:54 CEST 2003


Le Mercredi 13 Août 2003 13:50, Daniel Campos a écrit :
> Hi!
>
> First of all : Thanks, Benoît, for the "info" files
> information.
>
>  Well, now i'm beggining to create a Socket
> component for Gambas. My idea (I'll work on
> it at September, cause tomorrow i'm going on
> Hollydays) is to create a complete "networking" component
> with the following classes:
>
> (RoadMap version 0.0.1)
>
> networing
>
> +- DnsClient : a class to convert form names to IPs and viceversa
>
> +- SockClient : A client for TCP, UDP and UNIX sockets
>
> +- SockServer : A server wich accepts multiple connections (TCP/UNIX
> sockets)
>
> +- FtpClient : A client to simplify connections with ftp servers
>
> All these Classes will be multithreated in order to make the
> work as comfortable as possible.

Alas you CAN'T do multithreading, because the interpreter can't support it. 
More precisely, you cannot raise a gambas event into a thread.

It is the reason why for me the network component is TWO components : one for 
the client, one for server. The client can have all you describe, and the 
server will implement the single-threading socket watching loop !


>
> The next step will be :
>
>
> +- SerialPort : A class to communicate via RS-232/422/485 interfaces
>
>
> and may be...
>
> +- UsbPort? : communications via USB cable

Why not ? I have no skill about that.

>
>
>  As at work my main "know-how" is to communicate with another computers
> and dispositives, I must announce that I will work hard on this
> component to have a powerful "gambas-network".
>
>  The first week of September at least there will be a functional
> DnsClient, and at the end of September a full-featured "client Socket"
> and the first step of a socket server.

So please separate the server stuff from the client stuff. It is really two 
different things. 

In general, when you are a client, you just send things and wait for the 
response. You need to manage connections only when you are a server.

>
>  Anybody interested in joinning that project, please feel  free to send
> me comments and ideas. (I anybody wants to send me any source code,
> please do it at my personal address danielcampos at ...47..., as a
> receive Gambas-devel as a "daily-digest", and I can't extract
> attachments  correctly). Remember that I can't reply until september!
>
>  First documentation:
>
> Class : DnsClient
>
> Properties :
>
> *RemoteHostName --> String (for instance "www.yahoo.es"), writeable if
> Status=0
> *RemoteHostIP --> String (for instance "62.81.0.1"), writeable if
> status=0
> *Status (read-only) --> 0 inactive, 1 resolving...
>
> Methods :
>
> *GetHostName --> Sets ReomteHostName using current RemoteHostIP (if
> failed RemoteHostName="")
> *GetHostIP  --> Sets RemoeHostIP using current RemoteHostName (if failed
> RemoteHostIP="")
> *Stop         --> Stops current proccess (if any)
>
> Events :
>
> *HostResolved (bSuccess as Boolean) --> When proccess finished, TRUE on
> Success, FALSE if request falied
>
>
>
> Thanks!

If you can, do like I did with EXEC : a synchronous and an asynchronous mode 
for the client talk. It will be simpler for the user who just want a address 
resolution in one line of code.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list