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
ID: 9648954
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How To Loop - Python 19 89
clicking a shape in a frame array vb6 3 45
Problem to open text file 11 113
how to Classify of email (pdf attachments) 7 36
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

831 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