Author | Topic: Accessing / Referencing a Windows Socket | |
---|---|---|
![]() | Jonathan Leeming | Accessing / Referencing a Windows Socket on Sun, 18 Jun 2017 10:11:07 -0600 I am using CXP in conjunction with TCP/IP Windows Sockets. When I create and use a socket within my CXP application and then call it again I can not reuse the same socket using the original nSocket value that I pass / access using ::session:nSocket. I can retrieve the nSocket value but attempts to use it fail with "Internal data structures corrupted". Is there any way to reuse the same socket connection in successive iterations of my application? I've reviewed the documentation and found the following functions that may help but they raise the following questions: The function SocketGethandle() apparently gets the window handle but I don't see any other functions that do anything with the handle... I'm sure there is a purpose??? If one enables socket debugging where is it logged and / or how does one use it? SocketSetOption( nSocket, SO_DEBUG, .T.) The SocketBind shows promise but how would I reference the socket from onother process? In my case this would be the the various CXP programs. SocketBind( <nSocket> , ; [<nAddressFamily>], ; <xLocalAddress , ; <nPort> , ; [@<nError>] ) The SocketBind() documentation states... "Unless a name is bound to a socket, there is no way for other processes to reference it and, as a consequence, no data may be received on it." What I am trying to do is create a CXP application that makes a socket connection to another computer acting as a server. No data is stored or directly accessible from the CXP computer with all file operations (reading & updating records) do via the socket server. I want to avoid having to make a new socket connection for each CXP program but rather have the same socket connection used. Login.cxp calls menu.cxp which calls BrowseEngage.cxp. As browses a data file BrowseEngage.cxp will call itself and I want to use the same nSocket. Any suggestions / ideas appreciated! Thanks... Jonathan |