Active X Usage
Posted: Thu Dec 08, 2011 7:17 am
Magic Router ActiveX is used for creating secure tunnel between client side and server side. If your client application need a secure tunnel, include hardware/user authentication, compression or encryption, use Magic Router ActiveX as your active control.
Take the following as a Magic Router Active X usage.
Take MySQL Database as example.
The Original MySQL listen port is 3306, you can change it to 3307 or keep using 3306.
Server side:
1. We go to set the listen port of MySQL Database from 3306 to 3307 in my.ini config file.
2. Start up Magic Router, in Coding page, select server router mode, select AES encryption and input AES password (this password must same as client side). If you need hardware (hardware info string as user name, 32 characters long) or user authentication, enable it.
3. Set listen port to 3306, forward port to 3307, to host as 192.168.1.1 (as local ip, use 127.0.0.1 is slower). Click Start button to listen.
Client side:
Version 1.0.0
1. Copy the following 5 files to client application folder.
INSTALL.BAT, MR.EXE, MM.EXE, MD.DAT, MSWINSCK.OCX
2 .Run INSTALL.BAT with Administrator right to install Magic Router Active X control. If you want to install active x by programming, you can issue this line to register: MM.EXE /regserver
Version 2.0.0
1. Copy the complete Magic Router folder to client application folder.
2 .Run InstallActiveX.exe with Administrator right to install Magic Router Active X control. If you want to install active x by programming, you can issue this line to register: MM.EXE /regserver
3. The following sample line is creating active control, for your application to start up listen socket and connect to Magic Router server side.
ooo = CreateObject("MagicRouter.ActiveX")
2. After create the active x object, start the following command to start and setup tunnel to Magic Router server side.
Version 1.0.0
ooo.Start(ListenPort, ServerIP, ForwardPort, UserName, UserPass, Coding, AesKey, ShiftByte)
where ListenPort is number, the port of local user machine
ServerIP is String, ip of the application server
ForwardPort is number, listen port of application server
UserName is string, max 32 characters, leave empty if not using authentication
UserPass is string, max 32 characters
Coding from 0 to 4, see parameter for more help
AesKey is string, max 32 characters
ShiftByte is number, from 1 to 254
ie. ooo.Start(3306, "192.168.1.1", 3306, "AlfeeKwok", "12345678", 2, "ServerAESPasswrod", 0)
Version 2.0.0 (ssl3 parameter is added)
ooo.Start(InListenPort, InServerIP, InForwardPort, InUserName, InUserPass, InCoding, InAesKey, InShiftByte, InSSLCmd)
InCoding = 5 as SSL3
leave InSSLCmd to empty as default SSL3 command, you can change to different exe name or different config file name
ie. \stunnel\stunnelx.exe stunnelx.conf
4. Magic Router Active X is started, you can find a MM.EXE is running under process list. But sometimes if the listen port is already used by another application, Magic Router Active X may not start up correctly. Then see ErrLog.txt for detail.
5. You can create more object to start up another listen port for your application at the same time.
ie. ooo2.Start(1433, "192.168.1.1", 1433, "AlfeeKwok", "12345678", 2, "ServerAESPasswrod", 0), open a socket locally on client machine, to connect to final MS Database server.
6. Start method of Magic Router Active X object is allow run once, if run more than 1, Magic Router Active X Server may not shutdown correctly. It does not matter, keep running will not harm system.
7. OK now, everything is already, you can issue your connection to local machine port instead of connect to server port.
this is visual foxpro sample, connect to local user machine.
cn = sqlstring("DRIVER=MySQL ODBC 3.51 Driver;DATABASE=test;SERVER=127.0.0.1;UID=root;PASSWORD=rtyufghn;PORT=3306;OPTION=2051;STMT=;")
8. It is not necessary to release the active x control, most programming language will clear all resources while shut down.
9. Overview: The above active x programming is used to simulate a server listen port, create a listen port on local user machine. Most secure connection is connected locally instead of connect to remote server ip/port directly. Then all sending out data can be encrypted before going out.
Take the following as a Magic Router Active X usage.
Take MySQL Database as example.
The Original MySQL listen port is 3306, you can change it to 3307 or keep using 3306.
Server side:
1. We go to set the listen port of MySQL Database from 3306 to 3307 in my.ini config file.
2. Start up Magic Router, in Coding page, select server router mode, select AES encryption and input AES password (this password must same as client side). If you need hardware (hardware info string as user name, 32 characters long) or user authentication, enable it.
3. Set listen port to 3306, forward port to 3307, to host as 192.168.1.1 (as local ip, use 127.0.0.1 is slower). Click Start button to listen.
Client side:
Version 1.0.0
1. Copy the following 5 files to client application folder.
INSTALL.BAT, MR.EXE, MM.EXE, MD.DAT, MSWINSCK.OCX
2 .Run INSTALL.BAT with Administrator right to install Magic Router Active X control. If you want to install active x by programming, you can issue this line to register: MM.EXE /regserver
Version 2.0.0
1. Copy the complete Magic Router folder to client application folder.
2 .Run InstallActiveX.exe with Administrator right to install Magic Router Active X control. If you want to install active x by programming, you can issue this line to register: MM.EXE /regserver
3. The following sample line is creating active control, for your application to start up listen socket and connect to Magic Router server side.
ooo = CreateObject("MagicRouter.ActiveX")
2. After create the active x object, start the following command to start and setup tunnel to Magic Router server side.
Version 1.0.0
ooo.Start(ListenPort, ServerIP, ForwardPort, UserName, UserPass, Coding, AesKey, ShiftByte)
where ListenPort is number, the port of local user machine
ServerIP is String, ip of the application server
ForwardPort is number, listen port of application server
UserName is string, max 32 characters, leave empty if not using authentication
UserPass is string, max 32 characters
Coding from 0 to 4, see parameter for more help
AesKey is string, max 32 characters
ShiftByte is number, from 1 to 254
ie. ooo.Start(3306, "192.168.1.1", 3306, "AlfeeKwok", "12345678", 2, "ServerAESPasswrod", 0)
Version 2.0.0 (ssl3 parameter is added)
ooo.Start(InListenPort, InServerIP, InForwardPort, InUserName, InUserPass, InCoding, InAesKey, InShiftByte, InSSLCmd)
InCoding = 5 as SSL3
leave InSSLCmd to empty as default SSL3 command, you can change to different exe name or different config file name
ie. \stunnel\stunnelx.exe stunnelx.conf
4. Magic Router Active X is started, you can find a MM.EXE is running under process list. But sometimes if the listen port is already used by another application, Magic Router Active X may not start up correctly. Then see ErrLog.txt for detail.
5. You can create more object to start up another listen port for your application at the same time.
ie. ooo2.Start(1433, "192.168.1.1", 1433, "AlfeeKwok", "12345678", 2, "ServerAESPasswrod", 0), open a socket locally on client machine, to connect to final MS Database server.
6. Start method of Magic Router Active X object is allow run once, if run more than 1, Magic Router Active X Server may not shutdown correctly. It does not matter, keep running will not harm system.
7. OK now, everything is already, you can issue your connection to local machine port instead of connect to server port.
this is visual foxpro sample, connect to local user machine.
cn = sqlstring("DRIVER=MySQL ODBC 3.51 Driver;DATABASE=test;SERVER=127.0.0.1;UID=root;PASSWORD=rtyufghn;PORT=3306;OPTION=2051;STMT=;")
8. It is not necessary to release the active x control, most programming language will clear all resources while shut down.
9. Overview: The above active x programming is used to simulate a server listen port, create a listen port on local user machine. Most secure connection is connected locally instead of connect to remote server ip/port directly. Then all sending out data can be encrypted before going out.