Re: Address in use, Winsock
try this
Code:
Private Sub Form_Load()
ws.Close
ws.Connect "192.168.1.11",1007
End Sub
Re: Address in use, Winsock
Okay right now it seems to be working, thank you.
Re: Address in use, Winsock
Right now it doesn't say address in use, but when I try to send a specific text, it says "Wrong protocol or connection state for the requested transaction ot request."
Here is the code:
Code:
Private Sub Form_Load()
Me.Icon = LoadResPicture(ReadINI("MainWindow", "Icon", "UI.ptf", "MAIN"), vbResIcon)
ws.Close
ws.Connect "192.168.1.11", 1007
ws.SendData ReadINI("INISection", "FirstErrNotify", "comunication.ptf", "[ERRREP]!")
When I substitute the ReadINI function, with a static text like this
it works fine. I can't understand it!
Please help me!
Re: Address in use, Winsock
Try reading the data (using readini) to a string variable, and then use that variable to send data.... (I am not sure about this, just a thought)... :wave:
eg:
Code:
Private Sub Form_Load()
Me.Icon = LoadResPicture(ReadINI("MainWindow", "Icon", "UI.ptf", "MAIN"), vbResIcon)
ws.Close
ws.Connect "192.168.1.11", 1007
dim strTemp as string
strTemp=ReadINI("INISection", "FirstErrNotify", "comunication.ptf", "[ERRREP]!")
ws.SendData strTemp
Re: Address in use, Winsock
Re: Address in use, Winsock
Whats in the variable? Have you stepped through?
Re: Address in use, Winsock
For the time being the ReadINI function returns this "Program Error!". If you want here is the code in ReadINI
Code:
Public Function ReadINI(riSection As String, riKey As String, riFile As String, riDefault As String) As String
Dim sRiBuffer As String
Dim sRiValue As String
Dim sRiLong As String
Dim INIFile As String
INIFile = App.Path & "\" & riFile
If Dir(INIFile) <> "" Then
sRiBuffer = String(255, vbNull)
sRiLong = GetPrivateProfileString(riSection, riKey, Chr(1), sRiBuffer, 255, INIFile)
If Left$(sRiBuffer, 1) <> Chr(1) Then
sRiValue = Left$(sRiBuffer, sRiLong)
If sRiValue <> "" Then
ReadINI = sRiValue
Else
ReadINI = riDefault
End If
Else
ReadINI = riDefault
End If
Else
ReadINI = riDefault
End If
End Function
But I actually found that on the Internet.
I guess that's what you meant by variable, pino?
Re: Address in use, Winsock
Have you tried removing the explination mark - Might be a problem with that character. I cant see why but give it a try.
If you say that ws.SendData "Test" - Works then you have a problem with you INI function you need to make sure that the value returned from this function is correct - Step through the program using break points.
Re: Address in use, Winsock
Actually I tried out also something else
Code:
ws.SendData InputBox("", "", ReadINI("INISection", "FirstErrNotify", "ui.ptf", "[ERRREP]!"))
in this code I show an input box and set the text from ReadINI as default, when I run the program and click OK on the input box it works.