Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Howto do simple TCP/IP programming using VBA

Posted on 2000-03-03
7
Medium Priority
?
7,042 Views
Last Modified: 2013-11-13
can I do some simple TCP/IP programming using VBA ?  I guess I should be able to do that since I can call DLLs.  Can some one show some simple example ?  What I want to do is open a very simple telnet session, send some strings over, then receive the response, then close the connection.  Any one know how to call those WinSock APIs?  Thanks
0
Comment
Question by:c722
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Expert Comment

by:pookytoo
ID: 2579352
The easiest way will be to use a ocx to do everything for you. You can find a sample at:
http://support.microsoft.com/support/kb/articles/Q185/7/26.ASP?LNG=ENG&SA=ALLKB&FR=0

The sample is created in VB, but it should be no problem to use it's code in Access modules and forms.
0
 

Author Comment

by:c722
ID: 2579449
Thanks. I just checked the code.  I'm afraid I can't use that.  I need complete control of the sockets in the low level, i.e., like calling connect(), send() BSD style functions.  I'm doing something very simple so not afford to use ocx.
0
 
LVL 1

Accepted Solution

by:
pookytoo earned 600 total points
ID: 2579547
There is a sample that shows it at http://tcfreenet.org/people/parity/winsock.htm
It contains a module that has all the functions declared that you'll need. Maybe worth looking at.....
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:ivanc
ID: 2579835
c722

Here is a sample, I hope it is helpful

Private Sub Form_Load()
' The name of the Winsock control is tcpClient.
' Note: to specify a remote host, you can use
' either the IP address (ex: "121.111.1.1") or
' the computer's "friendly" name, as shown here.
tcpClient.RemoteHost = "137.132.160.240"
tcpClient.RemotePort = 1001
tcpClient.Connect
End Sub

Private Sub tcpClient_DataArrival _
(ByVal bytesTotal As Long)
Dim strData As String
Dim n As Integer
tcpClient.GetData strData
txtoutput.text = strData
End Sub

Private Sub Form_Unload()
tcpClient.Close
Unload Me
End Sub

This codes are for the client

Ivanc
0
 

Author Comment

by:c722
ID: 2580325
this is what I'm looking for!  I did BSD socket programming in C before.  So I just need a quick way to call them in Basic, a language I'm not familiar with.  Thanks

I wanted to share the points with another writer....see can do it or not...
0
 

Author Comment

by:c722
ID: 2580334
sorry ivanc  I cannot split the points...
0
 
LVL 3

Expert Comment

by:ivanc
ID: 2580906
c722

Don't mind glad that your program is working.

Ivanc
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question