Solved

Howto do simple TCP/IP programming using VBA

Posted on 2000-03-03
7
5,362 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 36
delphi parse string to params 3 97
Change the path of the data source in my Excel pivot table with macro 4 33
vbModal 12 30
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

947 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

16 Experts available now in Live!

Get 1:1 Help Now