NETIO HMG 3.0.0

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: NETIO HMG 3.0.0

Post by Vanguarda »

Hi friend,

Thanks for the info.

My best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: NETIO HMG 3.0.0

Post by karweru »

NetIo has been updated and it's now possible not only to create directories in a remote pc but much much more due to the introduction of RPCs. This, in my humble opinion is a great leap forward, and a much appreciated new year gift from Czerpak.
Date: Wed, 06 Jan 2010 16:16:24 +0000
From: druzus@users.sourceforge.net
Subject: [Harbour] SF.net SVN: harbour-project:[13489] trunk/harbour
To: harbour@harbour-project.org
Message-ID: <E1NSYYa-0000vU-PV@74yxhf1.ch3.sourceforge.com>
Content-Type: text/plain; charset=UTF-8

Revision: 13489
http://harbour-project.svn.sourceforge. ... 9&view=rev
Author: druzus
Date: 2010-01-06 16:16:22 +0000 (Wed, 06 Jan 2010)

Log Message:
-----------
2010-01-06 17:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/hbznet.c
! do not use DEF_MEM_LEVEL to avoid potential problems when <zutil.h>
is not available

* harbour/contrib/hbnetio/netio.h
* harbour/contrib/hbnetio/netiocli.c
* harbour/contrib/hbnetio/netiosrv.c
+ implemented RPC in HBNETIO protocol
+ added the following client functions:
check if function/procedure exists on the server side:
NETIO_PROCEXISTS( <cProcName> ) -> <lExists>
execute function/procedure on server the side,
do not wait for confirmation:
NETIO_PROCEXEC( <cProcName> [, <params,...>] ) -> <lSent>
execute function/procedure on the server side and wait for
confirmation:
NETIO_PROCEXECW( <cProcName> [, <params,...>] ) -> <lExecuted>
execute function on the server side and wait for its return value:
NETIO_FUNCEXEC( <cFuncName> [, <params,...>] ) -> <xFuncRetVal>
All above functions use default connection set by NETIO_CONNECT()
for RPCs but it's also possible to specify server address and port
in <cProcName>/<cFuncName> just like in <cFileName> parameter in RDD
functions, i.e.:
NETIO_PROCEXISTS( "192.168.0.1:10005:MYFUNC" )
+ added new server side functions to enable/disable/check RPC support:
NETIO_RPC( <pListenSocket> | <pConnectionSocket> [, <lEnable> ] )
-> <lEnabled>
if RPC is enabled for listen socket then connection sockets inherit
this setting.
+ added 4-th parameter <lRPC> to NETIO_LISTEN() function. .T. enable
RPC support in returned listen socket which is later inherited by
connection sockets
* changed protocol version ID - current NETIO clients and servers
cannot be used with old code

* harbour/contrib/hbnetio/utils/netiosrv.prg
* added option to enable RPC support in NETIO server

If you want to make some test then you can execute netiosrv with
non empty 4-th parameter as server, i.e.:
./netiosrv "" "" "" 1
and try this code as client:

proc main()
// pass server address to netio_connect() for non localhost tests
? "NETIO_CONNECT():", netio_connect()
?
? "DATE() function is supported:", netio_procexists( "DATE" )
? "QOUT() function is supported:", netio_procexists( "DATE" )
? "HB_DATETIME() function is supported:", ;
netio_procexists( "HB_DATETIME" )
?
? netio_procexec( "QOUT", repl( "=", 50 ) )
? netio_procexec( "QOUT", "This is RPC TEST", date(), hb_datetime() )
? netio_procexecw( "QOUT", repl( "=", 50 ) )
?
? "SERVER DATE:", netio_funcexec( "DATE" )
? "SERVER TIME:", netio_funcexec( "TIME" )
? "SERVER DATETIME:", netio_funcexec( "HB_DATETIME" )
?
? netio_funcexec( "upper", "hello world !!!" )
return

Please remember that only functions linked with server are available.
If you want to enabled all core functions in netiosrv then please
uncomment this line in netiosrv.prg:
REQUEST __HB_EXTERN__


Have a fun with a new toy. I hope that many Harbour user will find it
very interesting. Please only be careful !!!. This feature allows to
execute remotely _ANY_ code on the server side. _NEVER_ leave open ports
with RPC support for untrusted access.

Modified Paths:
--------------
trunk/harbour/ChangeLog
trunk/harbour/contrib/hbnetio/netio.h
trunk/harbour/contrib/hbnetio/netiocli.c
trunk/harbour/contrib/hbnetio/netiosrv.c
trunk/harbour/contrib/hbnetio/utils/netiosrv.prg
trunk/harbour/src/rtl/hbznet.c


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Kind regards,
Gilbert.
User avatar
luisvasquezcl
Posts: 1262
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: NETIO HMG 3.0.0

Post by luisvasquezcl »

Hola Vanguarda:
excelente demo, el código es muy claro, realmente queda para ser material de consulta., gracias por liberarlo
Saludos cordiales,
Luis Vasquez.
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: NETIO HMG 3.0.0

Post by Vanguarda »

luisvasquezcl wrote:Hola Vanguarda:
excelente demo, el código es muy claro, realmente queda para ser material de consulta., gracias por liberarlo
Saludos cordiales,
Luis Vasquez.
Thanks my Friend.

My best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: NETIO HMG 3.0.0

Post by Vanguarda »

karweru wrote:NetIo has been updated and it's now possible not only to create directories in a remote pc but much much more due to the introduction of RPCs. This, in my humble opinion is a great leap forward, and a much appreciated new year gift from Czerpak.
Date: Wed, 06 Jan 2010 16:16:24 +0000
From: druzus@users.sourceforge.net
Subject: [Harbour] SF.net SVN: harbour-project:[13489] trunk/harbour
To: harbour@harbour-project.org
Message-ID: <E1NSYYa-0000vU-PV@74yxhf1.ch3.sourceforge.com>
Content-Type: text/plain; charset=UTF-8

Revision: 13489
http://harbour-project.svn.sourceforge. ... 9&view=rev
Author: druzus
Date: 2010-01-06 16:16:22 +0000 (Wed, 06 Jan 2010)

Log Message:
-----------
2010-01-06 17:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/hbznet.c
! do not use DEF_MEM_LEVEL to avoid potential problems when <zutil.h>
is not available

* harbour/contrib/hbnetio/netio.h
* harbour/contrib/hbnetio/netiocli.c
* harbour/contrib/hbnetio/netiosrv.c
+ implemented RPC in HBNETIO protocol
+ added the following client functions:
check if function/procedure exists on the server side:
NETIO_PROCEXISTS( <cProcName> ) -> <lExists>
execute function/procedure on server the side,
do not wait for confirmation:
NETIO_PROCEXEC( <cProcName> [, <params,...>] ) -> <lSent>
execute function/procedure on the server side and wait for
confirmation:
NETIO_PROCEXECW( <cProcName> [, <params,...>] ) -> <lExecuted>
execute function on the server side and wait for its return value:
NETIO_FUNCEXEC( <cFuncName> [, <params,...>] ) -> <xFuncRetVal>
All above functions use default connection set by NETIO_CONNECT()
for RPCs but it's also possible to specify server address and port
in <cProcName>/<cFuncName> just like in <cFileName> parameter in RDD
functions, i.e.:
NETIO_PROCEXISTS( "192.168.0.1:10005:MYFUNC" )
+ added new server side functions to enable/disable/check RPC support:
NETIO_RPC( <pListenSocket> | <pConnectionSocket> [, <lEnable> ] )
-> <lEnabled>
if RPC is enabled for listen socket then connection sockets inherit
this setting.
+ added 4-th parameter <lRPC> to NETIO_LISTEN() function. .T. enable
RPC support in returned listen socket which is later inherited by
connection sockets
* changed protocol version ID - current NETIO clients and servers
cannot be used with old code

* harbour/contrib/hbnetio/utils/netiosrv.prg
* added option to enable RPC support in NETIO server

If you want to make some test then you can execute netiosrv with
non empty 4-th parameter as server, i.e.:
./netiosrv "" "" "" 1
and try this code as client:

proc main()
// pass server address to netio_connect() for non localhost tests
? "NETIO_CONNECT():", netio_connect()
?
? "DATE() function is supported:", netio_procexists( "DATE" )
? "QOUT() function is supported:", netio_procexists( "DATE" )
? "HB_DATETIME() function is supported:", ;
netio_procexists( "HB_DATETIME" )
?
? netio_procexec( "QOUT", repl( "=", 50 ) )
? netio_procexec( "QOUT", "This is RPC TEST", date(), hb_datetime() )
? netio_procexecw( "QOUT", repl( "=", 50 ) )
?
? "SERVER DATE:", netio_funcexec( "DATE" )
? "SERVER TIME:", netio_funcexec( "TIME" )
? "SERVER DATETIME:", netio_funcexec( "HB_DATETIME" )
?
? netio_funcexec( "upper", "hello world !!!" )
return

Please remember that only functions linked with server are available.
If you want to enabled all core functions in netiosrv then please
uncomment this line in netiosrv.prg:
REQUEST __HB_EXTERN__


Have a fun with a new toy. I hope that many Harbour user will find it
very interesting. Please only be careful !!!. This feature allows to
execute remotely _ANY_ code on the server side. _NEVER_ leave open ports
with RPC support for untrusted access.

Modified Paths:
--------------
trunk/harbour/ChangeLog
trunk/harbour/contrib/hbnetio/netio.h
trunk/harbour/contrib/hbnetio/netiocli.c
trunk/harbour/contrib/hbnetio/netiosrv.c
trunk/harbour/contrib/hbnetio/utils/netiosrv.prg
trunk/harbour/src/rtl/hbznet.c


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Hi friend,

It´s a very good NEW.
I´ll test it ASAP.

My best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
Ismach
Posts: 166
Joined: Wed Nov 28, 2012 5:55 pm
DBs Used: DBF, mySQL, Mariadb, postgreSQL, Oracle, Db2, Interbase, Firebird, and SQLite
Location: Buenos Aires - Argentina

Re: NETIO HMG 3.0.0

Post by Ismach »

Hola Muchachos yo tengo este codigo que solia compilar en una version de hmg anterior, instale la ultima y ya no compila ni trae el codigo de la libreria socket quisiera saber como lo compilo en la nueva version y si puedo hacerlo por hbnetio o si alguno tiene un ejemplo de coneccion por socket usando la nueva version de hmg... desde ya muchas gracias :roll:

Code: Select all

#include "hbsocket.ch"

#define EOT      ( Chr( 4 ) )

FUNCTION Main()

        Local oSocket AS OBJECT
        Local ccSending
        Local ccReceive
        Local adMiPc,  ccNamePc
        Local cServer  := "10.132.189.31"
        Local nPort    := 1956

        oSocket  := TSocket():New()
        ccNamePc := oSocket:GetLocalName()
        ? "Mi PC: " + ccNamePc
        adMiPc   := oSocket:GetLocalAddress()
        ? "Binding....."
        oSocket:Bind(cServer,  nPort)
        if  oSocket:Connect( cServer, nPort )

            ? "Connected"

            ccLineaChar := "1009162010BUENOS AIRES20151121.32.2345678ARSARS   BALDAR ASOP. G898F" + hb_OSNewLine()
            ? "Sending : " + ccLineaChar
            ? oSocket:SendString( ccLineaChar )

            ? "Esperando Recibir..."
            ccReceive := oSocket:ReceiveString()

            ? "Respuesta : " + ccReceive

            ? "Close connection"
            if oSocket:Close()
                 ? "Close successfull"
            else
                 ? "Error on close connection"
            endif
        else
            ? "Refused"
        endif

RETURN Nil
User avatar
Ismach
Posts: 166
Joined: Wed Nov 28, 2012 5:55 pm
DBs Used: DBF, mySQL, Mariadb, postgreSQL, Oracle, Db2, Interbase, Firebird, and SQLite
Location: Buenos Aires - Argentina

Re: NETIO HMG 3.0.0

Post by Ismach »

Me contesto Solo.. :lol: . lo que hago es conectar un WorkStation con Win7 con un Unix Aix.
lo acabo de resolver asi y funciona de diez :

Code: Select all

FUNCION M32_Send_Host( cHostAix, nPuertito, cRequest )

      LOCAL pSocket, cBuffer, nBytes, cResponse

      INetInit()
      pSocket := INetConnect( cHostAix, nPuertito )

      IF INetErrorCode( pSocket ) <> 0
         // MsgIngo( "Socket error:" + INetErrorDesc( pSocket ) )
         INetCleanUp()
         QUIT
      ENDIF

      cRequest := "1009162010BUENOS AIRES20151121.32.2345678ARSARS   BALDAR ASOP. G898F" + INetCRLF()
      nBytes   := INetSend( pSocket, cRequest )
      cResponse:= ""

      DO WHILE nBytes > 0
         cBuffer   := Space( 4096 )
         nBytes    := INetRecv( pSocket, @cBuffer )
         cResponse += Left( cBuffer, nBytes )
      ENDDO

      INetClose( pSocket )
      INetCleanUp()

      // Memowrit( "Afip32.txt", cResponse )

Return( cResponse )
User avatar
danielmaximiliano
Posts: 2647
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: NETIO HMG 3.0.0

Post by danielmaximiliano »

Gracias por compartir Ismach
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply