How to write networking code in VBA?

J

Joe User

I am quite familiar with BSD networking API. But I don't know the first
thing about network programming in VBA. I've done a Google search, and I
will continue to do so. But so far, I have not found a concrete example
(that I can access). I would very much appreciate some hand-holding.

Here is what I want to do in a macro. It's really very rudimentary.

on error goto done
connect(TCP) to ipAddress:portNumber
for each line (read from a file or otherwise provided by the macro)
send line (terminated by \r\n on the wire)
recv response (one line terminated by \r\n on the wire)
next
done:
on error goto 0
close connection

One issue.... TCP itself is not message (line) oriented. A remote system
might transmit a line (response) in multiple TCP packets. Ideally, I would
like the VBA "recv response" to be line-oriented. If there is an option to
enable that behavior, I would like to know how to do that.

One complication.... I might need to know how to start and stop a timer
before each network call. At least in UNIX, that would cause the call to
terminate with an error. Alternative, I would like to know how to enable
TCP keepalives, or that they are enabled by default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top