Sockets
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Sockets
Hi,
I get a GPF when I try and do a:
oSocket = TSocket():New( 2000 )
I am working with the sockcli.prg program from the \FWPPC\Samples folder.
What can be causing this error?
I get a GPF when I try and do a:
oSocket = TSocket():New( 2000 )
I am working with the sockcli.prg program from the \FWPPC\Samples folder.
What can be causing this error?
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Sockets
Jeff,
Have you created a window previously ?
Have you created a window previously ?
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: Sockets
Hi Antonio,
Yes, I have a window. In the window I click a button to activate the connection.
Here is the test code:
Yes, I have a window. In the window I click a button to activate the connection.
Here is the test code:
Code: Select all
#include "Fwce.ch"
STATIC oWnd, oSocket, cTitle:="Socket Test"
STATIC cSat, cHR, oTmr
Function Main()
LOCAL oBtn
DEFINE WINDOW oWnd TITLE cTitle
@ 1,1 BUTTON oBtn PROMPT "Connect" SIZE 75,25 ACTION Connect()
ACTIVATE WINDOW oWnd
Return Nil
Function Connect()
oSocket = TSocket():New( 2000 ) //Generates a GPF Here
oSocket:bRead = { | oSocket | oSocket:GetData }
oSocket:bConnect = { || oWnd:SetText( "Connected!" ) }
oSocket:bClose = { || MsgInfo( "Server has closed!" ) }
oSocket:Connect( "127.0.0.1" )
DEFINE TIMER oTmr INTERVAL 1000 of oWnd ACTION GetOxData()
ACTIVATE TIMER oTmr
return nil
Function GetOxData()
cSat := PADL( ALLTRIM(STR( ABS(HB_RandomInt( 85, 100 ) ) ) ),3," ")
cHR := PADL( ALLTRIM(STR( ABS(HB_RandomInt( 75, 150 ) ) ) ),3, " ")
SendOx( cSat, cHR )
Return Nil
Function SendOx(cSat, cHR )
oSocket:SendData( "MSG "+cSat+" "+cHR)
Return Nil
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Sockets
Jeff,
What Windows Mobile version are you using ?
Are you running on Windows CE ?
What Windows Mobile version are you using ?
Are you running on Windows CE ?
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: Sockets
From the "About Screen" on my mobile device:
Windows Mobile 6.5 Professional
CE OS 5.2.23090 (Build 23090.5.3.0)
Windows Mobile 6.5 Professional
CE OS 5.2.23090 (Build 23090.5.3.0)
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Re: Sockets
Jeff,
No sera esta linea ?
No sera esta linea ?
Q te faltan los parentesis de funcion ?oSocket:bRead = { | oSocket | oSocket:GetData }
Code: Select all
oSocket:bRead = { | oSocket | oSocket:GetData() }
Salutacions, saludos, regards
"...programar es fácil, hacer programas es difícil..."
https://modharbour.app
https://modharbour.app/compass
https://forum.modharbour.app
"...programar es fácil, hacer programas es difícil..."
https://modharbour.app
https://modharbour.app/compass
https://forum.modharbour.app
Re: Sockets
Jeff
Sorry, i know... in english
Can u try ?
Sorry, i know... in english
Can u try ?
Code: Select all
oSocket:bRead = { | oSocket | oSocket:GetData() }
Salutacions, saludos, regards
"...programar es fácil, hacer programas es difícil..."
https://modharbour.app
https://modharbour.app/compass
https://forum.modharbour.app
"...programar es fácil, hacer programas es difícil..."
https://modharbour.app
https://modharbour.app/compass
https://forum.modharbour.app
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: Sockets
Hi Carles,
I do have the line of code you mention but I get the GPF before I get that far.
This crashes the program: oSocket = TSocket():New( 2000 )
I do have the line of code you mention but I get the GPF before I get that far.
This crashes the program: oSocket = TSocket():New( 2000 )
Code: Select all
Function Connect()
oSocket = TSocket():New( 2000 ) //Generates a GPF Here
oSocket:bRead = { | oSocket | oSocket:GetData }
oSocket:bConnect = { || oWnd:SetText( "Connected!" ) }
oSocket:bClose = { || MsgInfo( "Server has closed!" ) }
oSocket:Connect( "127.0.0.1" )
DEFINE TIMER oTmr INTERVAL 1000 of oWnd ACTION GetOxData()
ACTIVATE TIMER oTmr
return nil
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Sockets
Hello Jeff
try use a port number more big... ie. 5000
try use a port number more big... ie. 5000
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
- Eugeniusz Owsiak
- Posts: 60
- Joined: Fri Oct 07, 2005 5:38 am
- Location: Poland
Re: Sockets
Hi Jeff
This is a piece of my working program on WM 5.0 platform.
Eugeniusz
Code: Select all
Function Connect()
memvar oSocket
oSocket = TSocket():New( 2000 )
oSocket:bRead = { | oSocket | OnRead( ) }
oSocket:bConnect = { | oSocket | OnConnect( ) }
oSocket:bClose = { | oSocket | OnClose( ) }
oSocket:Cargo := ST_COMMAND
oSocket:Connect( "192.168.1.2",2000 ) // server IP adres
Return nil
******************************
Function OnConnect( )
memvar lConnect,oWnd
lConnect := .T.
oWnd:SetText("Connect")
Return nil
**********************
function OnClose( )
memvar oSocket,lConnect
do case
case oSocket:Cargo == ST_SENDFILE
fclose( oSocket:hFile )
endcase
lConnect := .F.
oSocket:End()
return nil
Eugeniusz
-
- Posts: 4
- Joined: Fri Oct 07, 2011 1:05 am
Re: Sockets
I am wondering in generaly how WM will be supported as the WP7 Mango just rolled out.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Sockets
Steve,
I guess this is the only way to go if we want to keep using Harbour on Windows Phone and Metro:
http://peterdn.com/post/To-make-a-Metro ... 280a6.aspx
But first of all we need a Harbour built for .NET, something that we could have building Harbour with MS C .NET
I guess this is the only way to go if we want to keep using Harbour on Windows Phone and Metro:
http://peterdn.com/post/To-make-a-Metro ... 280a6.aspx
But first of all we need a Harbour built for .NET, something that we could have building Harbour with MS C .NET