spuppett
November 3rd, 2004, 08:40 AM
Hey all. I'm looking to send a record set from a server to a client. I thought I had it set up, but its not working. I was wonder if you all could look at it and tell me whats wrong?
I get the initial connection, and when I ask for the record set, it get that request to, and it does the send data just fine, but on the client side, I don't get in to the client_dataArrived method.
Thanks in advance.
'this is the server
Option Explicit
Dim rs As New ADODB.Recordset
Dim conn As New ADODB.Connection
Private Sub Form_Load()
listen.LocalPort = 1478
listen.listen
conn.ConnectionString = Adodc1.ConnectionString
conn.Open
rs.CursorType = adOpenDynamic
rs.Source = "SELECT * FROM hours"
Set rs.ActiveConnection = conn
rs.Open
End Sub
Private Sub Form_Unload(Cancel As Integer)
listen.Close
recieve.Close
Debug.Print "SOCKETS CLOSED"
End Sub
Private Sub listen_Close()
listen.Close
Debug.Print "Listen Close"
End Sub
Private Sub listen_ConnectionRequest(ByVal requestID As Long)
recieve.Accept requestID
Debug.Print requestID & ": requestID"
recieve.SendData Now
End Sub
Private Sub recieve_Close()
recieve.Close
Debug.Print "RECIEVE CLOSED"
End Sub
Private Sub recieve_DataArrival(ByVal bytesTotal As Long)
Dim dat As String
recieve.GetData dat, vbString
If dat = "RECORD" Then
recieve.SendData rs
End If
End Sub
'this is the client
Option Explicit
Dim database As String
Dim rsHours As New ADODB.Recordset
Dim con As New ADODB.Connection
Private Sub cmdGet_Click()
socket.SendData "RECORD"
End Sub
Private Sub cmdOK_Click()
socket.Close
Unload Me
End Sub
Private Sub Form_Load()
setUpSocket
setUpFlexGrid
End Sub
Private Sub Form_Unload(Cancel As Integer)
socket.Close
End Sub
Private Sub setUpFlexGrid()
End Sub
Private Sub setUpSocket()
socket.RemotePort = 1478
socket.RemoteHost = "xxx.xx.xx.xxx"
socket.Connect
End Sub
Private Sub socket_Close()
socket.Close
Debug.Print "SOCKET CLOSED"
End Sub
Private Sub socket_DataArrival(ByVal bytesTotal As Long)
Dim rs As New ADODB.Recordset
Dim rightNow As Date
socket.GetData rightNow
End Sub
I get the initial connection, and when I ask for the record set, it get that request to, and it does the send data just fine, but on the client side, I don't get in to the client_dataArrived method.
Thanks in advance.
'this is the server
Option Explicit
Dim rs As New ADODB.Recordset
Dim conn As New ADODB.Connection
Private Sub Form_Load()
listen.LocalPort = 1478
listen.listen
conn.ConnectionString = Adodc1.ConnectionString
conn.Open
rs.CursorType = adOpenDynamic
rs.Source = "SELECT * FROM hours"
Set rs.ActiveConnection = conn
rs.Open
End Sub
Private Sub Form_Unload(Cancel As Integer)
listen.Close
recieve.Close
Debug.Print "SOCKETS CLOSED"
End Sub
Private Sub listen_Close()
listen.Close
Debug.Print "Listen Close"
End Sub
Private Sub listen_ConnectionRequest(ByVal requestID As Long)
recieve.Accept requestID
Debug.Print requestID & ": requestID"
recieve.SendData Now
End Sub
Private Sub recieve_Close()
recieve.Close
Debug.Print "RECIEVE CLOSED"
End Sub
Private Sub recieve_DataArrival(ByVal bytesTotal As Long)
Dim dat As String
recieve.GetData dat, vbString
If dat = "RECORD" Then
recieve.SendData rs
End If
End Sub
'this is the client
Option Explicit
Dim database As String
Dim rsHours As New ADODB.Recordset
Dim con As New ADODB.Connection
Private Sub cmdGet_Click()
socket.SendData "RECORD"
End Sub
Private Sub cmdOK_Click()
socket.Close
Unload Me
End Sub
Private Sub Form_Load()
setUpSocket
setUpFlexGrid
End Sub
Private Sub Form_Unload(Cancel As Integer)
socket.Close
End Sub
Private Sub setUpFlexGrid()
End Sub
Private Sub setUpSocket()
socket.RemotePort = 1478
socket.RemoteHost = "xxx.xx.xx.xxx"
socket.Connect
End Sub
Private Sub socket_Close()
socket.Close
Debug.Print "SOCKET CLOSED"
End Sub
Private Sub socket_DataArrival(ByVal bytesTotal As Long)
Dim rs As New ADODB.Recordset
Dim rightNow As Date
socket.GetData rightNow
End Sub