|
Where this helps you or not. Here's some code to work with the VB6
WinSock.OCX
Option Explicit
Dim sBuffer() As String
Private Function PostWS_Data(ByVal Index As Long) As Boolean
Dim lLength As Long
Dim nFile As Integer
lLength = 0
PostWS_Data = False
With Connections(Index)
Select Case .BlockType
Case blkSingleRead
lLength = Len(sBuffer(Index))
Case blk2ByteHeader
If Len(sBuffer(Index)) >= 2 Then
lLength = cnvStringToLong(Left$(sBuffer(Index), 2))
If Len(sBuffer(Index)) >= (lLength + 2) Then
sBuffer(Index) = Mid$(sBuffer(Index), 3)
Else
lLength = 0
End If
End If
Case blk4ByteHeader
If Len(sBuffer(Index)) >= 4 Then
lLength = cnvStringToLong(Left$(sBuffer(Index), 4))
If Len(sBuffer(Index)) >= (lLength + 4) Then
sBuffer(Index) = Mid$(sBuffer(Index), 5)
Else
lLength = 0
End If
End If
Case blkFillBuffer
If Len(sBuffer(Index)) >= .BufferSize Then lLength = .BufferSize
Case blkDelimiter
lLength = InStr(1, sBuffer(Index), .Delimiter)
End Select
If lLength Then
If .RecordCount > UBound(.Text) Then ReDim Preserve .Text
(.RecordCount)
.Text(.RecordCount) = Left$(sBuffer(Index), lLength)
.RecordCount = .RecordCount + 1
If bLogToFile Then
nFile = FreeFile
Open "C:\T3Client.Log" For Append As #nFile
Print #nFile, .RecordCount & "RECV:" & vbCrLf & Left
$(sBuffer(Index), lLength)
Close #nFile
End If
sBuffer(Index) = Mid$(sBuffer(Index), lLength + 1)
PostWS_Data = True
End If
End With
End Function
Private Sub Form_Initialize()
ReDim sBuffer(0)
End Sub
Private Sub Form_Terminate()
ReDim sBuffer(0)
End Sub
Private Sub WS_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim sTmp As String
Connections(Index).ErrorNumber = 0
Connections(Index).ErrorDescription = ""
If bytesTotal Then
sTmp = Space$(bytesTotal)
WS(Index).GetData sTmp
If Index > UBound(sBuffer) Then ReDim Preserve sBuffer(Index)
sBuffer(Index) = sBuffer(Index) & sTmp
Do While PostWS_Data(Index): Loop
End If
End Sub
Private Sub WS_Error(Index As Integer, 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)
Connections(Index).ErrorNumber = Number
Connections(Index).ErrorDescription = Description
End Sub
Ken Slaugh (707) 795-1512 x118
Chouinard & Myhre, Inc.
AS/400 Professional Administrator/MSE
Client Access Specialist
http://www.cm-inc.com/
"Hatzenbeler, Tim"
<thatzenbeler@clin To: "'RPG400-L@midrange.com'"
itech.net> <RPG400-L@midrange.com>
Sent by: cc:
owner-rpg400-l@mid Subject: VB Socket Code.
range.com
07/20/00 11:33 AM
Please respond to
RPG400-L
Does anybody have a working example of socket code (client side), that is
written with visual basic, that they could post?
That would work with the RPG socket server code found in the book,
Sorcerer's Guide to system access..
Thanks, tim
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.