Dear all.

I am using Visual basic 2010. I have client device with IP 192.168.1.3 and port = 8899http://www.usriot.com/p/rs485-to-wifi-converters/

I am sending data serially with above device.

Data send in this format:

SMCB3,3,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,Temp_read:348,HV_Read:647,SPD:0,DIS:0
Once Ip address and port has being define. I need to keep connected to wifi device.I have written python code where i could able to receive data . Now i am planning to impliment same thing using visual basic.

I have created Text box. I need help in Put csv separated value into particular text box and If value read as Zero display particular button to RED , if text box value read , then display the button as green indicating string is active.

My python code. Where data1 contains

data1=SMCB3,3,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,Temp_read:348,HV_Read:647,SPD:0,DIS:0

Code:
import socket

TCP_IP = '192.168.1.3'
#TCTCP_IP1='192.168.1.2'
TCP_PORT = 8899
BUFFER_SIZE = 100
BUFFER_SIZE1=100
MESSAGE = "Hello, World!"

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
#s1.connect((TCTCP_IP1, TCP_PORT))

s.send(MESSAGE)
#s1.send(MESSAGE)
data = s.recv(500)
#data1= s1.recv(BUFFER_SIZE)

mod_hex=data.encode('hex').upper()
print 'Hexa decimal value Modified:',repr(mod_hex)


s.close()
#s1.close()
print "received data:", data
#print "received data:", data1
Here is Vb code. I need help to get started to connect IP address with particular port

Code:
Public Class Form1

    Dim selectedItem1 As String

    Private Sub SMCB1_clientIP_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SMCB1_clientIP.TextChanged

    End Sub


    Private Sub SMCB1_Connect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SMCB1_Connect.Click

        Dispay_Show.Text = SMCB1_clientIP.Text
        Dispay_Show.Text = SMCB1_clientIP.Text & vbNewLine
        Dispay_Show.AppendText(SMCB1_Port.Text)

    End Sub


    Private Sub SMCB1_Disconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SMCB1_Disconnect.Click

    End Sub
End Class
Name:  VB_String.jpg
Views: 384
Size:  19.1 KB