Solved

Howto do simple TCP/IP programming using VBA

Posted on 2000-03-03
7
5,228 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
  • 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 200 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now