locked
Wifi connectivity and VFP. RRS feed

  • Question

  • I'm deploying a system in which wifi win10 tablets running vfp use and update a single small table that resides on a server.

    the problem is that when the wifi drops it obviously runs into issues and problems.

    Is there a way to check connectivity before I issue refresh() or sql commands?

    I don't want to use something like if file("\\server\somefile") because that would be slow.

    Thanks!

    Monday, March 4, 2019 11:00 PM

Answers

  • Hi Aleniko2,

    I assume, there are no really better ways, but faster ways. :)

    Have a look at this thread at stackoverflow:

    https://stackoverflow.com/questions/5152647/how-to-quickly-check-if-unc-path-is-available

    HTH


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011

    • Marked as answer by Aleniko2 Thursday, March 7, 2019 4:56 PM
    Tuesday, March 5, 2019 10:44 AM
    Answerer
  • I don't know what you mean with "the socket solution"

    Winsock is all about TCP/IP, usage of it is mainly about HTTP or a self define propiretary approach, but you can't open files throug sockets, this is communication with a serverr, and not a server computer but a web server or other server softwaree listening on a port.

    If you want to go that route you have to program a SQL Server listening for requests and acting locally on DBFs, returning HTML or XML or any other format of your own design.

    So if you want to go client server in regards of DBF files you first have to create a server, VFP is none, the clients are the server, they don't just load data from DBFs, they even load code from DBCs and execute stored procedures, also triggers.

    The easiest way to have a VFP server is a COM Server DLL, and that requzires some knowlegde about remote COM, CreateObjectEX is one piece of the puzzle of instanciating a server side COM Server to which the DBFs stored server side are local, but then forget just USEing tables and sharing the data session of table comserver with your VFP tablet client application, you have to transfer the data some way and if you want the same client server functionality as with an SQL server database you can't accoomplish that with a COM Server alone, the client side will need to convert incoming XML or anything into local cursors, a solutiojn that really could do that would be an ODBC driver on top of a server, but then you go for C++ and dig into the details of what ODBC has as its internal data representation and command language, not only for receiving the requests from the client but also the data results from the server you connect to. All current VFP ODBC drivers don't connect to a server but just the file system, so they don't separate that file access from the client, that means even third party ODBC drivers like devart drivers provide a server, there ondce was vfpserver.com, but that vanished as no VFP developer went for it, VFP developers changed to MSSQL server backends, as those also open up connectivity to many more clients and client side languages and applications.

    So if you want to go client server, go client server, go MSSQL. Don't go fro winsock and starting from scratch with all communication and protocol necessary. Want to go for a simple interface just pushing in DBF files to the tablets. Fine, that's a prorietary solution, but you won't be able to use remote views then, you have to program the update of server side tables with something else, too. You're aiming for a proprietary solution only working for you, then.

    But I don't see a winsock solution. The simplest from current situation is looking at availability of shares with net share and hoping the connection stays active while working on remote files via unc paths. To not reinvent the wheel you'd go SQL Server and one way to stay with the dbfs for an unchanged client application on desktops is linked server. Has some problems, too, but tablets will connect to the MSSQL server hosting DBFs as linked server/database.

    As I said recently here (https://www.tek-tips.com/viewthread.cfm?qid=1793092) wifi access also is less ideal to MSSQL, though, unless the company is just having one access point and the problem of ssid switching through access point switching doesn't occur.

    Bye, Olaf.

    • Marked as answer by Aleniko2 Thursday, March 7, 2019 4:55 PM
    Thursday, March 7, 2019 10:51 AM

All replies

  • Hi Aleniko2,

    I assume, there are no really better ways, but faster ways. :)

    Have a look at this thread at stackoverflow:

    https://stackoverflow.com/questions/5152647/how-to-quickly-check-if-unc-path-is-available

    HTH


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011

    • Marked as answer by Aleniko2 Thursday, March 7, 2019 4:56 PM
    Tuesday, March 5, 2019 10:44 AM
    Answerer
  • The net use solution could work for me. Not sure how to implement the socket solution in vfp.

    Thanks!

    Tuesday, March 5, 2019 3:27 PM
  • Hi,

    Do you resolve the issue? If you resolve the issue,  please mark the helpful as answer.

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 7, 2019 9:13 AM
  • I don't know what you mean with "the socket solution"

    Winsock is all about TCP/IP, usage of it is mainly about HTTP or a self define propiretary approach, but you can't open files throug sockets, this is communication with a serverr, and not a server computer but a web server or other server softwaree listening on a port.

    If you want to go that route you have to program a SQL Server listening for requests and acting locally on DBFs, returning HTML or XML or any other format of your own design.

    So if you want to go client server in regards of DBF files you first have to create a server, VFP is none, the clients are the server, they don't just load data from DBFs, they even load code from DBCs and execute stored procedures, also triggers.

    The easiest way to have a VFP server is a COM Server DLL, and that requzires some knowlegde about remote COM, CreateObjectEX is one piece of the puzzle of instanciating a server side COM Server to which the DBFs stored server side are local, but then forget just USEing tables and sharing the data session of table comserver with your VFP tablet client application, you have to transfer the data some way and if you want the same client server functionality as with an SQL server database you can't accoomplish that with a COM Server alone, the client side will need to convert incoming XML or anything into local cursors, a solutiojn that really could do that would be an ODBC driver on top of a server, but then you go for C++ and dig into the details of what ODBC has as its internal data representation and command language, not only for receiving the requests from the client but also the data results from the server you connect to. All current VFP ODBC drivers don't connect to a server but just the file system, so they don't separate that file access from the client, that means even third party ODBC drivers like devart drivers provide a server, there ondce was vfpserver.com, but that vanished as no VFP developer went for it, VFP developers changed to MSSQL server backends, as those also open up connectivity to many more clients and client side languages and applications.

    So if you want to go client server, go client server, go MSSQL. Don't go fro winsock and starting from scratch with all communication and protocol necessary. Want to go for a simple interface just pushing in DBF files to the tablets. Fine, that's a prorietary solution, but you won't be able to use remote views then, you have to program the update of server side tables with something else, too. You're aiming for a proprietary solution only working for you, then.

    But I don't see a winsock solution. The simplest from current situation is looking at availability of shares with net share and hoping the connection stays active while working on remote files via unc paths. To not reinvent the wheel you'd go SQL Server and one way to stay with the dbfs for an unchanged client application on desktops is linked server. Has some problems, too, but tablets will connect to the MSSQL server hosting DBFs as linked server/database.

    As I said recently here (https://www.tek-tips.com/viewthread.cfm?qid=1793092) wifi access also is less ideal to MSSQL, though, unless the company is just having one access point and the problem of ssid switching through access point switching doesn't occur.

    Bye, Olaf.

    • Marked as answer by Aleniko2 Thursday, March 7, 2019 4:55 PM
    Thursday, March 7, 2019 10:51 AM
  • Didn't test yet. Will do when at customer site. Thanks!
    Thursday, March 7, 2019 4:53 PM
  • Olaf; as always, thank you for the detailed response. I would avoid C/S solution for now. Net use parsing is the best as of now.

    Thanks!

    Thursday, March 7, 2019 4:55 PM