I just started building an app to interact with Sony Pro TV's via ethernet. I have been able to initialize the tv and bring them up but I have to use syswait after all calls to the socket. Upon connecting to the TV it returns 4 messages all about 22 bytes each. Is there a way to determine when the reading of data is complete so I know when to senddata to the TV. After each senddata the TV responds with 1 to n messages, again I would like to know when it is finished so I know when to ask the next question. For now I wait 1 second and it seems to work. Reminds me of the days with RS232.
Thanks,
Socket Programming good practice
-
- Posts: 388
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Socket Programming good practice
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
- Antonio Linares
- Site Admin
- Posts: 42268
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Socket Programming good practice
Dear Byron,
Here you have a good example of using Harbour's sockets:
https://github.com/FiveTechSoft/wsserve ... server.prg
Here you have a good example of using Harbour's sockets:
https://github.com/FiveTechSoft/wsserve ... server.prg
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Socket Programming good practice
Antonio Linares wrote:Dear Byron,
Here you have a good example of using Harbour's sockets:
https://github.com/FiveTechSoft/wsserve ... server.prg
I don't know if it's the same thing but I would have to synchronize a warehouse that is in my school and another that is located in another location and I haven't understood how to do it, can we have a practical example to try with?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
-
- Posts: 388
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Re: Socket Programming good practice
I am using tsocket from Fivewin, is that not recommended any more? This works, it just uses waits which I always frown upon.
Code: Select all | Expand
function InitializeSonyPro( nListenPort,cBraviaIp )
Local oSocket := nil
oSocket = TSocket():New( nListenPort )
oSocket:Connect( cBraviaIp )
SysWait( 1 ) // wish I could get rid of these...
// GetIpCommandString returns the sony command it text.
oSocket:SendData( GetIpCommandString("setPowerStatusOn" ) )
SysWait( 1 )
oSocket:SendData( GetIpCommandString("setInputHDMI1" ) )
SysWait( 1 )
oSocket:Close()
return nil
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services