[Gambas-user] Newbie question: socket example
T Lee Davidson
t.lee.davidson at gmail.com
Sun Jan 31 23:33:39 CET 2021
On 1/31/21 1:52 PM, pf wrote:
> newbie Question
>
> I try o use the Socket component. Enabled the component in a new project and put in the example code from the help.
>
> It got stuck on the ClsMain, "Unknown identifier"
>
> Regards Chris
>
> Paste from the help i use:
>
> ' Gambas class file STATIC App AS ClsMain PUBLIC MySock AS Socket PUBLIC SUB MySock_Ready() WRITE #MySock,"Hello",5 END PUBLIC
> SUB MySock_Read() DIM sCad AS String READ #MySock,sCad,Lof(MySock) PRINT sCad CLOSE #MySock END PUBLIC SUB _New() MySock=NEW
> Socket AS "MySock" MySock.Connect("name_of_host",3450) END PUBLIC SUB MySock_Error() PRINT "Unable to connect" END STATIC PUBLIC
> SUB Main() App=NEW ClsMain END
>
I am unsure where you got that example. It is not the one I see here:
http://gambaswiki.org/wiki/comp/gb.net/socket
Nonetheless, the class file that contains that code needs to be named "ClsMain.class".
--
Lee
More information about the User
mailing list