-
Socket
Hi all
i'm using Access 2002 , i need to know how i can send a Request to out side program thro Socket port 1086 and get the result back > using Code .
thanks
Best Regards
I'm always here to help
-
ChatGPT answer my 2002 question :)
To send a request through socket port 1086 and receive a result using code in Microsoft Access 2002, you could use the Winsock Control. Winsock is a component that allows you to send and receive data through a network socket.
Here is an example of how you could send a request through socket port 1086 and receive a result using VBA code in Access 2002:
Add the Winsock control to your form by going to "Tools" -> "Additional Controls" and selecting "Microsoft Winsock Control 6.0"
Create a new form and place the Winsock control on it.
In the code module of the form, add the following code:
Private Sub Form_Load()
Winsock1.RemoteHost = "127.0.0.1" ' The IP address of the server
Winsock1.RemotePort = 1086 ' The socket port you want to use
Winsock1.Connect
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
' Do something with the received data, e.g. display it in a text box
TextBox1.Text = strData
End Sub
Note: You will need to replace "127.0.0.1" with the IP address of the server that you want to connect to, and you may need to modify the code to handle the received data as needed.
This code will establish a connection to the remote server using socket port 1086 and display any received data in a text box.
Originally Posted by alzikan
Hi all
i'm using Access 2002 , i need to know how i can send a Request to out side program thro Socket port 1086 and get the result back > using Code .
thanks
Best Regards
-
Just a quick tip: be cautious with error handling. Especially when working with network sockets, there can be a ton of unforeseen issues like connection timeouts, data transfer interruptions, etc. I've found that adding robust error handling in your VBA code makes life a lot easier.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|