borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Visual Basic)Next Topic (Error message about common dialog control) New Topic New Poll Post Reply
AndreaVB Forum : VB General : TCP/IP- Connection
Poster Message
jonybd
Level: Master

Registered: 18-01-2005
Posts: 116

icon TCP/IP- Connection

I trying to connect as following, and i see i am connected to the server. But i dont receive anything, the manual told to send me data as following, can anyone give a sign what type of string or varialbe to be used here, and what could be the value, i realy need to send so that atleast i see i am doing correct?

Manual for interconnect TCP/IP:
1. packets on the tcp socket are always 256 bytes long, they contain one or more primitives, each primitive has a type octet and a lenght octet. A primitive can have fixed size fields and vairable size fields. When a field has a variable size, the first octet of the field always contains the size of the field excluding the length octet.
2. Option mask format to send to server for getting responce explain in manual.
3. Please check the attached file.

0x23
Length=108 or 60
12345678
12345678
bit 0-2:
000:32456789123:test
001:ip address 1
010:ip address 2
011:32484848990:test
100:
....
111

bit 3:
set to 1 if need

bit 4-6:
000:not use
001:324856789231
010:323232323232
011:
....
111

000:not use
001:324856789231
010:323232323232
011:
....
111

bit 7: set to 0


---- my code i am trying.....


Private Sub Command1_Click()
    With Winsock1
        If .State <> sckConnected Then
            If .State <> sckClosing Then 'Sometimes the Winsock gets delayed in the closing state, so make sure it is closed before trying again
                If .State = sckClosed Then 'If closed, ok to open, else close it ,Start 5 second count
                   .Protocol = sckTCPProtocol
                   .Connect "one1.one.com", "5900"
                Else
                   .Close
                End If
                
            Else
               .Close
                
            End If
        End If
    End With
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    If Not Winsock1.State = sckConnected Then
        Winsock1.Close
        Winsock1.Accept requestID
    End If
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
   ReDim gbIOBuff(bytesTotal)
   Winsock1.GetData gbIOBuff, vbArray + vbByte, bytesTotal
   Text1.Text = Text1.Text & gbIOBuff & bytesTotal
End Sub

Private Sub Command2_Click()
    Winsock1.SendData Text3.Text + Chr(13)
End Sub


[Edited by jonybd on 09-06-2008 at 08:26 PM GMT]

____________________________
Attached:
Demo.zip 12 KB (Downloads: 0)

08-06-2008 at 06:30 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB General : TCP/IP- Connection
Previous Topic (Visual Basic)Next Topic (Error message about common dialog control) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder