Francis
2008-10-01 13:48:48 UTC
hello,
I attempt to use Microsoft Winsock Control with my dBasePlus 2.61.5
this activex seems work fine except when I getdata in the ACTIVEXSer_DataArrival event.
the bytestotal parameter give the good length (18).
the getdata(receivedata) do not fill the receivedata string.
I send "-test test test-"+ chr(13) + chr(10) with PUSHBUTTONSEND.onClik
This is the sample:
** END HEADER -- do not remove this line
//
// Generated on 25/09/2008
//
parameter bModal
local f
f = new WinSockForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class WinSockForm of FORM
with (this)
canClose = class::FORM_CANCLOSE
onOpen = class::FORM_ONOPEN
height = 11.0
left = 34.7143
top = 6.4545
width = 30.0
text = "MsWinSock"
mdi = false
sizeable = false
mousePointer = 1 // Arrow
maximize = false
endwith
this.PUSHBUTTONSEND = new PUSHBUTTON(this)
with (this.PUSHBUTTONSEND)
onClick = class::PUSHBUTTONSEND_ONCLICK
height = 1.2
left = 2.0
top = 0.15
width = 4.0
text = ""
speedBar = true
upBitmap = "RESOURCE #20"
disabledBitmap = "RESOURCE #21"
speedTip = "Start"
group = true
endwith
this.BTNEND1 = new PUSHBUTTON(this)
with (this.BTNEND1)
onClick = {;Form.Close()}
height = 1.2
left = 24.0
top = 0.15
width = 4.0
text = ""
speedBar = true
upBitmap = "RESOURCE #1005"
disabledBitmap = "RESOURCE #1006"
speedTip = "Quitter"
group = true
endwith
this.ACTIVEXSER = new ACTIVEX(this)
with (this.ACTIVEXSER)
height = 1.2
left = 8.0
top = 0.15
width = 4.0
borderStyle = 3 // None
license = "2c49f800-c2dd-11cf-9ad6-0080c7e7b78d"
state = "DCFEEFCDBJBBBBBBPGBDBBBBPGBDBBBBKDOJJODFBBBBBHBBBBBBBBBBBBBBBBBBBBBBBBBBGJCMBBBB"
classId = "{248DD896-BB45-11CF-9ABC-0080C7E7B78D}"
endwith
with (this.ACTIVEXSER.nativeObject)
ConnectionRequest = class::ACTIVEXSER_CONNECTIONREQUEST
DataArrival = class::ACTIVEXSER_DATAARRIVAL
endwith
this.ACTIVEXCLI = new ACTIVEX(this)
with (this.ACTIVEXCLI)
height = 1.2
left = 13.0
top = 0.15
width = 4.0
borderStyle = 3 // None
license = "2c49f800-c2dd-11cf-9ad6-0080c7e7b78d"
state = "DCFEEFCDBJBBBBBBPGBDBBBBPGBDBBBBKDOJJODFBBBBBHBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
classId = "{248DD896-BB45-11CF-9ABC-0080C7E7B78D}"
endwith
function form_onOpen
clear
form.TcpSer = this.activexSer.nativeObject
form.TcpSer.protocol = 0 && 0 TCP, 1 UDP
form.TcpSer.localPort = 7000
form.TcpSer.listen()
? "Listen Ser:", form.TcpSer.state
form.TcpCli = this.activexCli.nativeObject
form.TcpCli.protocol = 0 && 0 TCP, 1 UDP
form.TcpCli.remoteHost = form.TcpSer.localIp &&"192.168.1.45"
form.TcpCli.remotePort = 7000
form.TcpCli.connect()
? "Connect Cli:", form.TcpCli.state
return
function form_canClose
form.TcpSer.close()
form.TcpCli.close()
return true
function PUSHBUTTONSEND_onClick
local sData
? "Status Cli:", form.TcpCli.state
if form.TcpCli.state = 7
sData = "-test test test-"+ chr(13) + chr(10)
form.TcpCli.sendData(sData)
endif
//NETSTAT -a to see TCP ports
return
function ACTIVEXSer_ConnectionRequest(requestID)
if form.TcpCli.state = 7
if this.state > 0
this.close()
endif
this.accept(requestID)
endif
return
function ACTIVEXSer_DataArrival(bytesTotal)
? program(), str(bytesTotal,4)
local receiveData
receiveData = replicate("0", bytesTotal)
this.getData(receiveData)
? program(), "-"+ receiveData +"-"
return
endclass
I attempt to use Microsoft Winsock Control with my dBasePlus 2.61.5
this activex seems work fine except when I getdata in the ACTIVEXSer_DataArrival event.
the bytestotal parameter give the good length (18).
the getdata(receivedata) do not fill the receivedata string.
I send "-test test test-"+ chr(13) + chr(10) with PUSHBUTTONSEND.onClik
This is the sample:
** END HEADER -- do not remove this line
//
// Generated on 25/09/2008
//
parameter bModal
local f
f = new WinSockForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class WinSockForm of FORM
with (this)
canClose = class::FORM_CANCLOSE
onOpen = class::FORM_ONOPEN
height = 11.0
left = 34.7143
top = 6.4545
width = 30.0
text = "MsWinSock"
mdi = false
sizeable = false
mousePointer = 1 // Arrow
maximize = false
endwith
this.PUSHBUTTONSEND = new PUSHBUTTON(this)
with (this.PUSHBUTTONSEND)
onClick = class::PUSHBUTTONSEND_ONCLICK
height = 1.2
left = 2.0
top = 0.15
width = 4.0
text = ""
speedBar = true
upBitmap = "RESOURCE #20"
disabledBitmap = "RESOURCE #21"
speedTip = "Start"
group = true
endwith
this.BTNEND1 = new PUSHBUTTON(this)
with (this.BTNEND1)
onClick = {;Form.Close()}
height = 1.2
left = 24.0
top = 0.15
width = 4.0
text = ""
speedBar = true
upBitmap = "RESOURCE #1005"
disabledBitmap = "RESOURCE #1006"
speedTip = "Quitter"
group = true
endwith
this.ACTIVEXSER = new ACTIVEX(this)
with (this.ACTIVEXSER)
height = 1.2
left = 8.0
top = 0.15
width = 4.0
borderStyle = 3 // None
license = "2c49f800-c2dd-11cf-9ad6-0080c7e7b78d"
state = "DCFEEFCDBJBBBBBBPGBDBBBBPGBDBBBBKDOJJODFBBBBBHBBBBBBBBBBBBBBBBBBBBBBBBBBGJCMBBBB"
classId = "{248DD896-BB45-11CF-9ABC-0080C7E7B78D}"
endwith
with (this.ACTIVEXSER.nativeObject)
ConnectionRequest = class::ACTIVEXSER_CONNECTIONREQUEST
DataArrival = class::ACTIVEXSER_DATAARRIVAL
endwith
this.ACTIVEXCLI = new ACTIVEX(this)
with (this.ACTIVEXCLI)
height = 1.2
left = 13.0
top = 0.15
width = 4.0
borderStyle = 3 // None
license = "2c49f800-c2dd-11cf-9ad6-0080c7e7b78d"
state = "DCFEEFCDBJBBBBBBPGBDBBBBPGBDBBBBKDOJJODFBBBBBHBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
classId = "{248DD896-BB45-11CF-9ABC-0080C7E7B78D}"
endwith
function form_onOpen
clear
form.TcpSer = this.activexSer.nativeObject
form.TcpSer.protocol = 0 && 0 TCP, 1 UDP
form.TcpSer.localPort = 7000
form.TcpSer.listen()
? "Listen Ser:", form.TcpSer.state
form.TcpCli = this.activexCli.nativeObject
form.TcpCli.protocol = 0 && 0 TCP, 1 UDP
form.TcpCli.remoteHost = form.TcpSer.localIp &&"192.168.1.45"
form.TcpCli.remotePort = 7000
form.TcpCli.connect()
? "Connect Cli:", form.TcpCli.state
return
function form_canClose
form.TcpSer.close()
form.TcpCli.close()
return true
function PUSHBUTTONSEND_onClick
local sData
? "Status Cli:", form.TcpCli.state
if form.TcpCli.state = 7
sData = "-test test test-"+ chr(13) + chr(10)
form.TcpCli.sendData(sData)
endif
//NETSTAT -a to see TCP ports
return
function ACTIVEXSer_ConnectionRequest(requestID)
if form.TcpCli.state = 7
if this.state > 0
this.close()
endif
this.accept(requestID)
endif
return
function ACTIVEXSer_DataArrival(bytesTotal)
? program(), str(bytesTotal,4)
local receiveData
receiveData = replicate("0", bytesTotal)
this.getData(receiveData)
? program(), "-"+ receiveData +"-"
return
endclass