[Gambas-user] UNIX SOCKETS
Charlie Reinl
Karl.Reinl at ...2345...
Fri Apr 2 23:45:11 CEST 2010
Am Freitag, den 02.04.2010, 22:34 +0100 schrieb Chris Dunworth:
> Hi All,
>
> Don't know if I'm doing something wrong or there is a bug
>
> Using Gambas 2.16 on SLAX 6.1.2 Linux Kernel 2.6.27.27
>
> Graphical application with Network programming option
>
> My class file
> ****************************************************************************************************
> Gambas class file
>
> PUBLIC MySock AS Socket
>
> PUBLIC SUB Button1_Click()
>
> DIM sBuf AS String
>
> MySock = NEW Socket
> 'MySock.Connect("localhost", 8080)
> MySock.Connect("/var/run/gtm2")
>
> PRINT "status1" & MySock.Status
>
>
> DO WHILE (MySock.Status <> 7) AND (MySock.Status > 0)
> WAIT 0.1
> LOOP
> PRINT " Status = " & MySock.Status
>
> IF MySock.Status <> 7 THEN
> PRINT "Error <>7 " & MySock.Status
> QUIT
> END IF
> PRINT "socket opened"
>
> sBuf = "Hello over there.\n"
> WRITE #MySock, sBuf, Len(sBuf)
>
> DO WHILE Lof(MySock) = 0
> WAIT 0.1
> LOOP
> READ #MySock, sBuf, Lof(MySock)
> PRINT sBuf
>
> CLOSE #MySock
>
> END
> '-------------------------------------------------------------
>
> PUBLIC SUB Button2_Click()
>
>
> DIM sOutput AS String
> EXEC ["python", "psock.py"] TO sOutput
>
> PRINT sOutput
> END
>
> '>>>>>>>>>>>>> psock.py <<<<<<<<<<<<<<<<<<<<<
> 'import socket
> '
> 's = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
> 's.connect("/var/run/gtm2")
> '
> 'data = s.recv(1024)
> 's.close()
> 'PRINT 'recvd ', repr(data)
> '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> **********************************************************************************************************************
>
> This calls a script via inetd that just sends a message and terminates
>
> The script is verified as working using psock.py ( code above )
>
> When run va Button2 works as expected
>
> When run via Button1 give errors thus
>
> status15
> Status = -6
> Error <>7 -6
> WARNING: circular references detected
> FMain (1)
> Mutex destroy failure: Device or resource busy------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> WARNING: 10 allocation(s) non freed.
>
> If tcp socket is used to connect to script then Button1 code works OK
>
> Can anybody help
>
> Thanks
>
> Chris Dunworth
>
> BTW superb product, keep up the good work
Salut,
as you use a very old version, please look at
http://gambas.sourceforge.net/en/changelog2.html
if a new version would not be better to use!
--
Amicalement
Charlie
More information about the User
mailing list