[VB6 ] 如何把座標值傳到PORT

看板Visual_Basic作者 (水瓶軌跡)時間18年前 (2007/05/11 15:36), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/2 (看更多)
請問我們怎麼用GPS去接收座標的值想要傳到PORT 然後在用PAPAGO去讀取這些座標..讓他可以去讀取匯出軌跡 現在我們的程式碼可以接收對方傳過來的值去自動存到記事本 可是在傳到PORT我們比較沒概念,不知道從著手,麻煩板上的高手大大指導一下 謝謝~~^^ Option Explicit Private intNowConnect As Integer '設定目前連接之Winsock Private blnServer As Boolean '判斷是否為Server端 Private Sub Command1_Click() 'Server建立連線 Dim I As Integer For I = 1 To 1 '設定本機連接埠 Winsock1(I).LocalPort = Str(5000 + I) '開始聆聽 Winsock1(I).Listen Next I blnServer = True Text3.Enabled = False Command1.Enabled = False 'Command2.Enabled = False 'Command3.Enabled = True Dim s As Integer s = Not CBool(Timer2.Interval) Command1.Caption = IIf(s, "停止", "Command1") Timer2.Interval = Abs(s) * 6 * 1000 End Sub Private Sub Timer2_Timer() Call Command4_Click End Sub Private Sub Command2_Click() Dim I As Integer 'Client設定連線資訊 For I = 0 To 2 '設定遠端IP Winsock1(I).RemoteHost = Text3.Text '設定遠端連接埠 Winsock1(I).RemotePort = Str(5000 + I) Next I 'Client開使連線 Winsock1(0).Connect Timer1.Enabled = True blnServer = False Text3.Enabled = False Command1.Enabled = False 'Command2.Enabled = False 'Command3.Enabled = True End Sub Private Sub Command3_Click() Dim I As Integer '取消連線 For I = 0 To 2 Winsock1(I).Close Next I Text3.Enabled = True Command1.Enabled = True 'Command2.Enabled = True 'Command3.Enabled = False End Sub Private Sub Command4_Click() If FreeFile = 1 Then Open "C:\Test.txt" For Append As #1 End If If Text1.Text = "" Then Close #1 Else Write #1, Text1.Text, Close #1 End If Text1.Text = "" Command1.Enabled = True Timer1.Interval = 5000 Timer1.Enabled = True End Sub Private Sub Form_Load() Dim I As Integer '設定切換Winsock用Timer Timer1.Enabled = False Timer1.Interval = 3000 intNowConnect = 0 Text1.Text = "" 'Text2.Text = "" Text3.Text = "210.71.14.219" 'Text4.Text = "Name" End Sub Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer) '呼叫Command4_Click送出對話訊息 If KeyCode = vbKeyReturn Then Call Command4_Click End Sub Private Sub Timer1_Timer() Dim I As Integer 'Client判斷是否已連線,若為連線則關閉Timer跳離Sub '否則切換下一Winsock,繼續連線 For I = 0 To 2 If Winsock1(I).State = sckConnected Then Timer1.Enabled = False Exit Sub Else Winsock1(I).Close End If Next I '切換下一Winsock,繼續連線 intNowConnect = intNowConnect + 1 If intNowConnect > 2 Then intNowConnect = 0 Winsock1(intNowConnect).Connect End Sub Private Sub Winsock1_Connect(Index As Integer) 'Client端連線成功 Put_Msg Index & " 上線了~" End Sub Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long) 'Server端接受Client之連線 If Winsock1(Index).State <> sckClosed Then Winsock1(Index).Close Debug.Print requestID Winsock1(Index).Accept requestID Put_Msg Index & " 上線了~" End Sub Private Sub Put_Msg(strMsg As String) '放置對話訊息 Text1.SelStart = Len(Text1.Text) Text1.SelText = strMsg & vbCrLf End Sub Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long) Dim I As Integer Dim strData As String '擷取擷取目前的資料區塊 Winsock1(Index).GetData strData Put_Msg strData '若為Server端,必須再將接收到之訊息傳送至其他Client If blnServer Then For I = 0 To 2 If I <> Index And Winsock1(I).State = sckConnected Then Winsock1(I).SendData strData DoEvents End If Next I End If End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.71.14.219

05/11 23:33, , 1F
請問「傳到port」是什麼意思@@?
05/11 23:33, 1F
文章代碼(AID): #16H1qEz3 (Visual_Basic)
文章代碼(AID): #16H1qEz3 (Visual_Basic)