Wanted demo project D435 - VB.Net through TCP/IP

примеры программ
Post Reply
ThorgalRose
Posts: 1
Joined: Fri Mar 05, 2010 7:01 am

Wanted demo project D435 - VB.Net through TCP/IP

Post by ThorgalRose » Fri Mar 05, 2010 7:11 am

Hello,

I'm looking for an example to communicate with simotion D435 and VB.NET through TCP/IP without OPC.

I have set up the D435 as TCP-server and use the VB.NET application as TCP/IP client.

This is no problem but i can't send DINT or reals, only bool and INT.
I can't figure out where the problem is situated. In the D435 or in VB.NET or in both?

Can somebody help me with this.

Best regards

Peter

Example D435

Code: Select all

        MyByte:=_byte_from_8bool(bit0:=v_send.woord5_Bit0,
                                 bit1:=v_send.woord5_bit1,
                                 bit2:=v_send.woord5_bit2,
                                 bit3:=v_send.woord5_bit3,
                                 bit4:=v_send.woord5_bit4,
                                 bit5:=v_send.woord5_bit5,
                                 bit6:=v_send.woord5_bit6,
                                 bit7:=v_send.woord5_bit7);
                 DATASEND:=ANYTYPE_TO_BIGBYTEARRAY(MyByte,4);                 
//6. Integer 1
                 DATASEND:=ANYTYPE_TO_BIGBYTEARRAY(v_send.int1,5);

IF vopenserver.clientaddress[0] = 192 THEN
            myRetDINT :=
            _tcpsend(
            connectionid := vopenserver.connectionId
            ,nextcommand := immediately
            ,datalength := LENGTH_DATA
            ,data := DATASEND);
            
        END_IF;

Example VB.NET 2003

Code: Select all

            BytesRead = client.GetStream.EndRead(ar)
            If BytesRead < 1 Then
                Exit Sub
            End If

            Dim clientdata As String = Encoding.ASCII.GetString(readBuffer)

            Dim s As String
            s = binair(readBuffer(0), 8)

            Dim intValue, b1, b2 As String
            b1 = binair(readBuffer(1), 8)
            b2 = binair(readBuffer(2), 8)
            intValue= b1 & b2
            intValue= Bin_To_Dec(intValue)

Post Reply