IP address and Port number with VBA and winsock

nector

Member
Local time
Today, 08:55
Joined
Jan 21, 2020
Messages
462
I want to send a message and receive a message using winsock to and from another computer in other city.I want to use VBA, and I have compiled a bas module which appear to be ok. The idea here is to try and translate the C++ code as below:

Code:
socketID = socket(AF_INET, SOCK_STREAM, 0)

VBA for sending:

Code:
count = send(socketID, ByVal strSend, Len(strSend), 0)

Questions?

Sending

On the socketID do I need to hard code the destination IP address and port number of the other computer in a different city? Any example

Receiving

On the socketID do I need to hard code my destination IP address and port number of my computer? How do I get to know my port number?

Code:
count = recv(socketID, buf(1), maxLength, iFlags)


I have no issue how to get my IP address by using IPconfig
 
You have started great. To obtain your IP address go to command prompt and type in ipconfig /all - see screenshot below:
1657044441059.png
 

Users who are viewing this thread

Back
Top Bottom