Sending a List Through Winsock

Posted on 2003-10-29
Last Modified: 2013-11-13
How do u send a list through winsock!!!

The layout of my app.


Private Sub CmdConnect_Click()
tcpclient.Connect txtip.Text, 3500
End Sub

Private Sub CmdCollect_Click()
tcpclient.SendData "msg"
' Here i want the code to send the drive's ------------------------------------
End Sub


Private Sub Form_Load()
End Sub

Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long)
tcpServer.Accept requestID
End Sub

Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long)
Dim vardata As String
Dim strdata As String
Dim cmddata As String * 3
tcpServer.GetData strdata
cmddata = Left(strdata, 3)
vardata = Right(strdata, Len(strdata) - 3)
DoCommand cmddata, vardata
End Sub

Private Sub tcpServer_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
On Error Resume Next
End Sub

Module 1

Public Function DoCommand(command As String, Data As String)  

Case "msg"
Msgbox "Connected, Requesting Sending Drive List"
' Here i want the code to accept the drive list and add it to a list -----------------------------
End Select
End Function

I want the client to send the case msg which it does then the Client to send the drive list from the form.
The Drive list is frmclient.Drive1
The List on the Server is

Thanx in Advance
Question by:iamatramp

Accepted Solution

JonothanTompson earned 150 total points
Comment Utility
Well i dont know how your planing to get ther drive list but sending the list is simple

*** This Sub creates the list to send
Private Sub CreateList() as String
Dim Total as Integer
Dim Done as Integer
Dim Whole as String
Total = *** insert toal number of drives (or whatever). Ill use Driver(index) from now on
Done = 0
Do until Total = Done
      Whole = Whole & Driver(Done) & VbTab
      Done = Done + 1
CreateList = Whole
End Function

*** This Sub Splits the List
Private Sub GetList(Whole as String)
Dim Temp as String
Dim Asci as Integer
Dim Drive as Integer
Do Until Len(Whole) = 0
      Temp = Left(Whole, 1)
      Whole = Right(Whole, Len(Whole) - 1)
      If Asci <> 9 Then
            Drive = Drive & Temp
      End If
      If Asci = 9 Then
            lstDrives.AddItem Drive *** This is where you use the information to do whaterver (this one puts it in a list box)
      End If
End Sub

*** This Code Is For Recieving The Information
Private Sub wskClient(ByVal bytesTotal As Long)
Dim Whole as String
Dim Temp as String
wskClient.GetData Whole
Temp = Left(Whole, 4)
Whole = Right(Whole, Len(Whole) - 4)
Select Case Temp
      Case "DVL_"
      Case Else
            Debug.Pring Whole
End Select
End Sub

All  the code is there that you will need just some of it you may need to change to suit the way you get the drive information.
A word of warning, i have done this code of the top of my head (comp didnt have VB), it should work.

Any questions just ask

Jonothan Tompson

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 92
Windows 10 start screen issues 9 46
SQL400 max size 5 52
Not needed 13 53
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

763 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

6 Experts available now in Live!

Get 1:1 Help Now