@@ -91,10 +91,10 @@ Public Class Nut_Socket
9191 Public Function Connect() As Boolean
9292 Try
9393 'TODO: Use LIST UPS protocol command to get valid UPSs.
94- Dim Host = Me . Nut_Config.Host
95- Dim Port = Me . Nut_Config.Port
96- Dim Login = Me . Nut_Config.Login
97- Dim Password = Me . Nut_Config.Password
94+ Dim Host = Nut_Config.Host
95+ Dim Port = Nut_Config.Port
96+ Dim Login = Nut_Config.Login
97+ Dim Password = Nut_Config.Password
9898
9999 If Not String .IsNullOrEmpty(Host) And Not IsNothing(Port) Then
100100 If Not Create_Socket(Host, Port) Then
@@ -133,12 +133,13 @@ Public Class Nut_Socket
133133
134134 Private Function Create_Socket( ByVal Host As String , ByVal Port As Integer ) As Boolean
135135 Try
136- Me .NutSocket = New Socket(AddressFamily.InterNetwork, ProtocolType.IP)
137- Me .NutTCP = New TcpClient(Host, Port)
138- Me .NutStream = NutTCP.GetStream
139- Me .ReaderStream = New StreamReader(NutStream)
140- Me .WriterStream = New StreamWriter(NutStream)
141- Me .ConnectionStatus = True
136+ ' NutSocket = New Socket(AddressFamily.InterNetwork, ProtocolType.IP)
137+ NutSocket = New Socket(SocketType.Stream, ProtocolType.IP)
138+ NutTCP = New TcpClient(Host, Port)
139+ NutStream = NutTCP.GetStream
140+ ReaderStream = New StreamReader(NutStream)
141+ WriterStream = New StreamWriter(NutStream)
142+ ConnectionStatus = True
142143 Catch Excep As Exception
143144 RaiseEvent OnNUTException( New Nut_Exception(Nut_Exception_Value.CONNECT_ERROR, Excep.Message), LogLvl.LOG_ERROR, Me )
144145 Me .ConnectionStatus = False
0 commit comments