|
-
Jul 11th, 2000, 01:22 AM
#1
Thread Starter
Hyperactive Member
Hi there! 
Does anybody know what is the best way to communicate between VB programs in a LAN(win9x)? Should I use Winsock for that? or any other method is there? I dont know anything abt Winsock programming. Please help me or guide me.
Jeba.
PS. Please provide code if u have.
-
Jul 11th, 2000, 01:32 AM
#2
Member
Map
Maybe this will help some it shows how to map a drive.
http://forums.vb-world.net/showthrea...threadid=21174
-
Jul 11th, 2000, 01:35 AM
#3
Member
Try the Winsock control, here is an example of a project i made :
Code:
' CLIENT
Private Sub DeconnectCommand_Click()
tcpClient.Close
End Sub
Private Sub ConnectCommand_Click()
On Error GoTo CheckError
tcpClient.RemoteHost = PostText ' "XXX.XXX.XXX.XXX"
tcpClient.RemotePort = 1001
If tcpClient.State = sckConnecting Then
ErrorText.Text = "connecting..."
Else: tcpClient.Connect
End If
Exit Sub
CheckError:
Call ProcessError
End Sub
'******************************************************************************
' NETWORK
'******************************************************************************
Private Sub SendData(Message As String)
On Error GoTo CheckError
tcpClient.SendData Message
Exit Sub
CheckError:
Call ProcessError
End Sub
Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)
tcpClient.GetData StrData
If StrData = "E53" Then
ErrorText.Text = "Appli doesn't exist on the server"
Else: MsgBox "Error n° " & Right(StrData, Len(StrData) - 1)
End If
End Sub
Private Sub tcpClient_Close()
ErrorText.Text = "Server disconnected!"
Beep
tcpClient.Close
End Sub
'SERVER
Private NumCanal As Integer
Option Explicit
Private Sub Form_Load()
NumCanal = 0
tcpServer(0).LocalPort = 1001
tcpServer(0).Listen
End Sub
Private Sub tcpServer_ConnectionRequest(index As Integer, ByVal requestID As Long)
If index = 0 Then
NumCanal = NumCanal + 1
Load tcpServer(NumCanal)
tcpServer(NumCanal).LocalPort = 0
tcpServer(NumCanal).Accept requestID
tcpServer(NumCanal).SendData ("Ack")
End If
End Sub
Private Sub tcpServer_DataArrival(index As Integer, ByVal bytesTotal As Long)
On Error GoTo CheckError
tcpServer(index).GetData StrData
Exit Sub
CheckError:
tcpServer(index).SendData ("E" & Err.Number)
End Sub
With this, you can connect several clients to the server and disconnect both from client and server (as you want!)
Hope this help!
[Edited by (B2F)Tom on 07-11-2000 at 02:38 AM]
-
Jul 11th, 2000, 02:03 AM
#4
Thread Starter
Hyperactive Member
one more thing!
Hi Tom!
Thanx man! I will try that.
Can u give me a link for a winsock tutorial page(of course...for a beginner)? coz I have zero knowledge in winsock...
Jeba.
-
Jul 11th, 2000, 02:06 AM
#5
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|