Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > Retrieve info (winsock control)


Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2003, 12:25 AM
AWS's Avatar
AWS AWS is offline
Junior Contributor
 
Join Date: Dec 2002
Location: Netherlands
Posts: 253
Default Retrieve info (winsock control)


Hello, i trying to return info from an other computer like date and time, im using a client/server app for this. But can someone tell me whats wrong with the code because it doesnt work but no error's either.

This is the client side
Code:
Private Sub Command1_Click() Winsock1.SendData "PCI" End Sub Private Sub Form_Load() Winsock1.Connect "127.0.0.1", 1234 End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim strData As String Winsock1.GetData strData If strData = info Then MsgBox info End If End Sub


Server side
Code:
Private Sub Form_Load() Winsock1.LocalPort = 1234 Winsock1.Listen End Sub Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) Winsock1.Close Winsock1.Accept requestID End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim strData As String Winsock1.GetData strData If strData = "PCI" Then Call PC_INFO End If End Sub Private Sub PC_INFO() Dim Info As String Info = Date & Time Winsock1.SendData Info End Sub
__________________
Welcome To My World
Reply With Quote
  #2  
Old 09-23-2003, 03:31 PM
Phantasmagoria Phantasmagoria is offline
Centurion
 
Join Date: May 2003
Posts: 131
Default

The server isn't sending "info" to the client, so the If statement will never fire.

Code:
Winsock1.SendData Info

Will send something like "9/23/2003 17:30"; nowhere will it send the string "info". That's where creating some sort of protocol comes in :-)
__________________
Rule #1: Admin is always right
Rule #2: If Admin is wrong, see Rule #1
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MsFlexGrid & VBA msl Word, PowerPoint, Outlook, and Other Office Products 2 09-17-2006 03:21 PM
multi connections, one port? burningodzilla Communications 5 08-02-2005 05:04 PM
Creating a Winsock control at Run-time? wyrd Communications 4 03-28-2003 06:39 AM
WinSock vbsupernewbie Communications 1 09-12-2001 10:20 PM
Control Arrays: What, Why and How BillSoo Tutors' Corner 0 07-13-2001 12:46 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->