vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Mails senden, abrufen und decodieren - ganz easy ;-)  
 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: 09.01.06 13:56

Hallo PJ_Shorty, danke für die Antwort


hier habe ich das korrigiert, erhalte aber noch immer Fehler:
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 Command1_Click()
sckMain.Close
status.Caption = sckMain.State
End Sub
 
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.1"
    waageport.Text = "8000"
    uncpath.Text = "C:\test1.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 Verbind1
End Sub
 
Private Sub Verbind1()
    sckMain.Close
    Connection = False
    Label1.Caption = "Verbinde..."
    'ip = "10.10.56.2"
    ip = wipadd.Text
    'port = 8000
    port = waageport.Text
    sckMain.RemoteHost = ip
    sckMain.RemotePort = port
    sckMain.Connect
    status.Caption = sckMain.State
End Sub
 
Private Sub sckMain_Connect()
    Label1.Caption = "Verbindung OK"
    Connection = True
    'Sleep (600)
    Sleep (100)
    Timer1.Interval = 1000
    Timer1.Enabled = True
End Sub
Private Sub Send()
If sckMain.State <> sckConnected Then
   Timer1.Enabled = False
   'sckMain.Connect
End If
On Error Resume Next
If Connection Then sckMain.SendData "S" Else
status.Caption = "Verbindung down"
 '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)
    Connection = False
    'alert the user to the error
    Label1.Caption = "Program-Error | Grund:" & Description
    'MsgBox "Program-Error | Grund:" & Description
 
End Sub
Komisch ist, dass ich jetzt einen Error bekomme: (also manchmal läuft das Program durch und ich erhalte keinen Wert zurück)

error: Connection is forcefully

danke gruss
IPstyle

Skype: ip-style

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 & Telnet785ICE-MAN03.01.06 12:06
Re: VB & Telnet789PJ_Shorty03.01.06 12:13
Re: VB & Telnet834ICE-MAN03.01.06 15:49
Re: VB & Telnet878ipstyle0003.01.06 16:39
Re: VB & Telnet848ICE-MAN03.01.06 16:56
Re: VB & Telnet794ipstyle0003.01.06 21:35
Re: VB & Telnet783ICE-MAN03.01.06 22:08
Re: VB & Telnet970ipstyle0003.01.06 22:13
Re: VB & Telnet788ICE-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 & Telnet784PJ_Shorty03.01.06 22:35
Re: VB & Telnet796ipstyle0003.01.06 22:50
Re: VB & Telnet736ICE-MAN03.01.06 23:16
Re: VB & Telnet809PJ_Shorty03.01.06 23:22
Re: VB & Telnet765PJ_Shorty03.01.06 17:13
Re: VB & Telnet739ipstyle0003.01.06 13:13
Re: VB & Telnet777OldMan03.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 & Telnet835PJ_Shorty04.01.06 00:01
Re: VB & Telnet741PJ_Shorty04.01.06 00:01
Re: VB & Telnet715ipstyle0009.01.06 10:35
Re: VB & Telnet733ipstyle0009.01.06 13:33
Re: VB & Telnet739PJ_Shorty09.01.06 13:38
Re: VB & Telnet795ipstyle0009.01.06 13:56
Re: VB & Telnet727PJ_Shorty09.01.06 15:09
Re: VB & Telnet777ipstyle0013.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