Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


winsock port 1200 problem

winsock port 1200 problem

winsock port 1200 problem

hi i am new user for winsock.

in my code with winsock i connect to 672 port, but i couldnt connect to 1200 port.
i can connect with hyperterminal port=672 or port=1200
plese help me.

there is my code down.

Private Sub cmdConnect_Click()
On Error GoTo hata_g

If cmdConnect.Caption = "Connect" Then
sockMain.Connect txtHost.Text, txtPort.Text
cmdConnect.Caption = "DisConnect"
MsgBox "Connected"
cmdConnect.Caption = "Connect"
MsgBox "DisConnected"
End If

Exit Sub

MsgBox Err.Description
End Sub

Private Sub senddata_winsock()
dim strsend as string

strsend = "STP100" & vbTab & "100" & vbTab & "5" & vbCrLf
sockMain.SendData strsend
strsend = "GO" & vbCrLf
sockMain.SendData strsend
End Sub

RE: winsock port 1200 problem

What do you have at the receiving end?
You have to use the Connectionrequest routine at the other end for the connection to be completed. Hyperterminal probably does this.

CODE -->

'At receiving end
Private Sub Winsock1_ConnectionRequest(ByVal RequestID As Long)
If Winsock1.State <> sckClosed Then Winsock1.Close
Winsock1.Accept RequestID
End Sub 
See other examples of this and the example in VB6 help

Should have something like this

Better to say

CODE -->

If SendMain.state<> sckConnected then SendMain.close  'in case of existing error
Sendmain.Connect txtHost.Text, txtPort.Text 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close