vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Zippen wie die Profis!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Visual-Basic Einsteiger
Re: VB & Telnet 
Autor: ipstyle00
Datum: 03.01.06 21:35

Hallo

Ich war Azubi, aber nie gross damit was zu tun gehabt .. nimmer Azubi also, aber lernwillig halt


Ich hab hier noch ein Problem:
Programm laufen zu lassen als exe etc. klappt.
Debug auch alles ok. Daten rausschreiben klappt auch.

Das Problem ist, dass ich nach einigen Sekunden folgende Fehlermeldung erhalte:

Run-Time Error '40006'
Wrong protocol or connection state for the requested transaction or request

Könnt ihr direkt was damit Anfangen?


Hier der Code:
Option Explicit
Private ip As String
Private port As Integer
Private Connection As Boolean
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
    'MousePointer = vbHourglass
    MousePointer = vbDefault
    Connection = False
    Label1.Caption = "Warte auf Program Start ..."
    Label2.Caption = "Noch keine Daten vorhanden ..."
    wipadd.Text = "10.10.56.2"
    waageport.Text = "8000"
    uncpath.Text = "C:\waage2export.txt"
    'Call Connect
End Sub
 
Private Sub start_Click()
If wipadd.Text = Empty Then
MsgBox "Bitte IP-Adresse der Waage richtig eingeben."
End If
If waageport.Text = Empty Then
MsgBox "Bitte Port richtig eingeben."
End If
If uncpath.Text = Empty Then
MsgBox "Bitte UNC-Pfad richtig eingeben. (Vollständige Pfadangabe)"
End If
Call Connect
End Sub
Private Sub Connect()
    sckMain.Close
    Label1.Caption = "Verbinde..."
    'ip = "10.10.56.2"
    ip = wipadd.Text
    'port = 8000
    port = waageport.Text
    sckMain.RemoteHost = ip
    sckMain.RemotePort = port
    sckMain.Connect
End Sub
 
Private Sub sckMain_Connect()
    Label1.Caption = "Verbindung OK"
    Connection = True
    Sleep (600)
    Timer1.Interval = 10000
    Timer1.Enabled = True
End Sub
 
Private Sub Send()
sckMain.SendData "S"
 'Label3.Caption "Send S"
End Sub
 
Private Sub sckMain_DataArrival(ByVal bytesTotal As Long)
Dim Message As String
Dim F As Integer
   sckMain.GetData Message
   F = FreeFile
   Message = Right(Message, Len(Message) - 4)
   Label2.Caption = Message
   'Open "C:\test.txt" For Output As #F
   Open uncpath.Text For Output As #F
   Print #F, Message
   Close #F
End Sub
 
Private Sub Timer1_Timer()
   Send
   DoEvents
End Sub
Private Sub sckMain_Error(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)
    'alert the user to the error
    Label1.Caption = "Program-Error | Grund:" & Description
    'MsgBox "Program-Error | Grund:" & Description
 
End Sub
Danke Gruss
IPstyle
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
VB & Telnet1.359ipstyle0002.01.06 15:03
Re: VB & Telnet938ICE-MAN02.01.06 15:11
Re: VB & Telnet778ipstyle0002.01.06 15:33
Re: VB & Telnet865PJ_Shorty03.01.06 01:03
Re: VB & Telnet803ipstyle0003.01.06 07:32
Re: VB & Telnet790PJ_Shorty03.01.06 11:50
Re: VB & Telnet786ICE-MAN03.01.06 12:06
Re: VB & Telnet789PJ_Shorty03.01.06 12:13
Re: VB & Telnet835ICE-MAN03.01.06 15:49
Re: VB & Telnet878ipstyle0003.01.06 16:39
Re: VB & Telnet848ICE-MAN03.01.06 16:56
Re: VB & Telnet795ipstyle0003.01.06 21:35
Re: VB & Telnet784ICE-MAN03.01.06 22:08
Re: VB & Telnet970ipstyle0003.01.06 22:13
Re: VB & Telnet789ICE-MAN03.01.06 22:19
Re: VB & Telnet821ipstyle0003.01.06 22:23
Re: VB & Telnet756PJ_Shorty03.01.06 22:20
Re: VB & Telnet731ipstyle0003.01.06 22:29
Re: VB & Telnet785PJ_Shorty03.01.06 22:35
Re: VB & Telnet796ipstyle0003.01.06 22:50
Re: VB & Telnet736ICE-MAN03.01.06 23:16
Re: VB & Telnet810PJ_Shorty03.01.06 23:22
Re: VB & Telnet766PJ_Shorty03.01.06 17:13
Re: VB & Telnet739ipstyle0003.01.06 13:13
Re: VB & Telnet778OldMan03.01.06 13:29
Re: VB & Telnet895ipstyle0003.01.06 13:59
Re: VB & Telnet771PJ_Shorty03.01.06 17:10
Re: VB & Telnet755ipstyle0003.01.06 23:44
Re: VB & Telnet836PJ_Shorty04.01.06 00:01
Re: VB & Telnet741PJ_Shorty04.01.06 00:01
Re: VB & Telnet715ipstyle0009.01.06 10:35
Re: VB & Telnet734ipstyle0009.01.06 13:33
Re: VB & Telnet740PJ_Shorty09.01.06 13:38
Re: VB & Telnet795ipstyle0009.01.06 13:56
Re: VB & Telnet727PJ_Shorty09.01.06 15:09
Re: VB & Telnet778ipstyle0013.01.06 11:25
Re: VB & Telnet794PJ_Shorty13.01.06 19:03

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel