Hi!
I have a sequence where i create,open and send data to a socket. My problem is that if the IP thats used as end point not exists the socket still thinks its doing everything okay. And after the end of the transmit I stand there without any receipt(the data goes to a network printer who prints a receipt) and no errormessage, and abolutely no clue about how to catch it.
Ive tried to use socket.connected but that just returns sockets last state, which somehowe is true even though it doesnt exist a computer on the end point.
Ive also tried to handle it with the integer that socket.send returns. But i get the same value, success or fail doesnt matter.
Guess im missing something vital here so please point it out to me
- - - - - - - - - - - - - - - - - -
Im three apples high, Im blue, and i most certainly like that cold beer that should be every mans right after a hard days work!
I have a sequence where i create,open and send data to a socket. My problem is that if the IP thats used as end point not exists the socket still thinks its doing everything okay. And after the end of the transmit I stand there without any receipt(the data goes to a network printer who prints a receipt) and no errormessage, and abolutely no clue about how to catch it.
Code:
' Set up the socket and connect
socPrinter = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)
Dim addr As IPAddress = IPAddress.Parse(strPrinterIP)
Dim ipep As IPEndPoint = New IPEndPoint(addr,intPrinterPort)
socPrinter.Connect(ipep)
' Output bytes to printer and close socket.
socPrinter.Send(bytBuffer, 0, bytBuffer.Length, SocketFlags.None)
socPrinter.Close()
socPrinter = Nothing
Ive tried to use socket.connected but that just returns sockets last state, which somehowe is true even though it doesnt exist a computer on the end point.
Ive also tried to handle it with the integer that socket.send returns. But i get the same value, success or fail doesnt matter.
Guess im missing something vital here so please point it out to me
- - - - - - - - - - - - - - - - - -
Im three apples high, Im blue, and i most certainly like that cold beer that should be every mans right after a hard days work!