Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open Socket via VBA

Posted on 2013-01-28
3
Medium Priority
?
5,510 Views
Last Modified: 2013-01-30
Here's some code in VB.NET:

Dim port As Int32 = 9200
            Dim client As System.Net.Sockets.TcpClient = New System.Net.Sockets.TcpClient(server, port)
            Dim netStream As System.Net.Sockets.NetworkStream = client.GetStream()
            Dim charData As Char() = New Char() {}
            ReDim charData(data.Length)
            ' Translate the passed message into ASCII
            'Dim sb As StringBuilder = New StringBuilder()

            For i As Integer = 0 To data.Length - 1
                charData(i) = ChrW(data(i))
                'sb.Append(charData(i).ToString())
            Next
            'sb.Append("")
            data = System.Text.Encoding.ASCII.GetBytes(charData)
            netStream.Write(data, 0, data.Length)
            ' Close everything.
            netStream.Close()

Open in new window


I need similar functionality from within MS Access / VBA.

Essentially, I need to open a socket and send some data through it, then close the socket.

I'm trying to avoide 3rd party (paid) tools, if possible.

Thanks for your help.
0
Comment
Question by:Kaprice
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 38830453
Here's an article describing how to use the WinSock control:

Create a Syslog Sender/Receiver Using the MS Winsock Control

The ActiveX control can be a bit hard to locate but that is explained as well.

/gustav
0
 

Author Closing Comment

by:Kaprice
ID: 38838542
Thanks. That's a good article.
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 38838600
You are welcome!

/gustav
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

971 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