Python Forum
Sending Hex Code to Machine from Laptop using TCP/IP Protocal
Thread Rating:
  • 3 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending Hex Code to Machine from Laptop using TCP/IP Protocal
#1
Hi all, I am a newbie in Python Programming, I am trying to send this hex code " ABBA05B80000AF11"
to reset the Machine through Tcp/ IP Protocol

Do anyone know what I have did wrong , as i was unable to " reset" the machine after i send the Hex Code ,below is my code.
Please Refer.

import socket
import sys
import struct
import time
import binascii


host = '192.168.1.40'
port = 800

s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)


inputHex = binascii.unhexlify("ABBA05B80000AF11")


try:
    #remote_ip = socket.gethostbyname(host)
    s.connect((host, port))

except socket.gaierror:
    print('Hostname could not be resolved Exiting')
    sys.exit()


print('Socket connected to ' + host + ' on ip ')

try:
    while True:
        s.send(inputHex)
    print('Message sent Successfully')
    time.sleep(1)
    print('sending')

except socket.error:
    print('send fail')
    sys.exit()
Reply


Messages In This Thread
Sending Hex Code to Machine from Laptop using TCP/IP Protocal - by Brian_Cheong - May-08-2017, 07:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to summarize an article that is stored in a word document on your laptop? Mikedicenso87 2 703 Oct-06-2023, 12:07 PM
Last Post: Mikedicenso87
  sending byte in code? korenron 2 1,163 Oct-30-2022, 01:14 PM
Last Post: korenron
  I can`t find an IDE functioning in my laptop All_ex_Under 5 3,021 Aug-17-2020, 05:44 AM
Last Post: All_ex_Under
  Help For Slot Machine Code Rayaan 1 2,750 Mar-30-2020, 05:01 AM
Last Post: SheeppOSU
  run into issues while configuring visual-studio code on a win 7 machine. apollo 3 3,720 Sep-12-2019, 12:25 AM
Last Post: snippsat
  How to detect wireless modem connected serially to my laptop in python barry76 3 3,587 Jan-08-2019, 06:18 AM
Last Post: Gribouillis
  Using a Windows 7 Laptop MatthewWhebell 1 2,556 Jun-14-2018, 10:18 AM
Last Post: buran
  import keyboard module doesn't get found - working on laptop but no on raspberry pi.. HANSJORG2 1 8,208 Mar-16-2018, 02:48 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020