Wysyłając dane do kontrolera led, napotkałem na następujący problem. Przesyłam tablicę danych
byte[] zmianaIPiPORTU = new byte[34];
zmianaIPiPORTU[0] = (byte)0xff;
zmianaIPiPORTU[1] = (byte)0xff;
zmianaIPiPORTU[2] = (byte)0xff;
zmianaIPiPORTU[3] = (byte)0xff;
zmianaIPiPORTU[4] = (byte)0x00;
zmianaIPiPORTU[5] = (byte)0x00;
zmianaIPiPORTU[6] = (byte)0x00;
zmianaIPiPORTU[7] = (byte)0x00;
zmianaIPiPORTU[8] = (byte)0x68;//TYP PAKIETU
zmianaIPiPORTU[9] = (byte)0x32;//TYP KODU
zmianaIPiPORTU[10] = (byte)0x00;//ID STEROWNIKA
zmianaIPiPORTU[11] = (byte)0x3C;//KOD ROZKAZU
zmianaIPiPORTU[12] = (byte)0x01;
zmianaIPiPORTU[13] = (byte)0x00;
zmianaIPiPORTU[14] = (byte)x1; //IP pierwszy segment
zmianaIPiPORTU[15] = (byte)x2; //IP drugi segment
zmianaIPiPORTU[16] = (byte)x3; //IP trzeci segment
zmianaIPiPORTU[17] = (byte)x4; //IP czwarty segment
zmianaIPiPORTU[18] = (byte)0xC0; //brama 1 segment
zmianaIPiPORTU[19] = (byte)0xA8; //brama 2 segment
zmianaIPiPORTU[20] = (byte)0x01; //brama 3 segment
zmianaIPiPORTU[21] = (byte)0x01; //brama 4 segment
zmianaIPiPORTU[22] = (byte)0xff;
zmianaIPiPORTU[23] = (byte)0xff;
zmianaIPiPORTU[24] = (byte)0xff;
zmianaIPiPORTU[25] = (byte)0x00;
zmianaIPiPORTU[26] = (byte)0x14;//
zmianaIPiPORTU[27] = (byte)0x50;//port 5200
zmianaIPiPORTU[28] = (byte)0xff;
zmianaIPiPORTU[29] = (byte)0xff;
zmianaIPiPORTU[30] = (byte)0xff;
zmianaIPiPORTU[31] = (byte)0xff;
zmianaIPiPORTU[32] = (byte)0x75;
zmianaIPiPORTU[33] = (byte)0x0C;
Pozycja 26 i 27 to dwa bajty portu IP 5200 (tak to powinno wyglądać - podsłuchane WireSharkiem).
Z adresem IP wiem jak to zrobić, natomiast port to juz trudniejsza sprawa, ponieważ zajmuje wiecej niz jeden bajt;
Chciałbym w tym miejscu wstawiać port z TextBoxa. Proszę o ewentualne porady .