小编Siv*_*ran的帖子

使用netcat将命令发送到套接字

我正在向自定义协议TCP服务器发送文本命令.在下面的示例中,我发送2个命令并接收回写的响应.它在telnet和netcat中按预期工作:

$ nc 192.168.1.186 9760
command1
command2
theresponse
Run Code Online (Sandbox Code Playgroud)

我批量试用时不工作:

@echo off
cd..
cd C:\nc
nc 192.168.1.186 9760
00LI002LE99
end
Run Code Online (Sandbox Code Playgroud)

请帮帮我.

sockets shell tcp batch-file netcat

8
推荐指数
1
解决办法
2万
查看次数

将整数值转换为ip-address

如何将32位整数值转换为ip-address?

我有,int value=570534080并希望将其转换为192.168.1.34.

c embedded

6
推荐指数
2
解决办法
1万
查看次数

Python串口写功能不起作用

我是python的新手,并尝试使用serial和python 3编写数据.请帮助解决下面的错误.

>>> import serial
>>> check=serial.Serial(1)
>>> print(check.name)
COM2
>>> check.write("test")
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    check.write("test")
  File "C:\Python34\lib\site-packages\serial\serialwin32.py", line 283, in write
    data = to_bytes(data)
  File "C:\Python34\lib\site-packages\serial\serialutil.py", line 76, in to_bytes
    b.append(item)  # this one handles int and str for our emulation and ints for Python 3.x
TypeError: an integer is required
Run Code Online (Sandbox Code Playgroud)

python typeerror python-3.x

6
推荐指数
1
解决办法
1万
查看次数

tkinter 中带有滚动条的动态按钮 - Python

我需要在 tkinter 窗口中创建动态按钮,但我尝试了滚动条选项,它不能帮助我滚动 tkinter 窗口中的按钮,是否还有其他选项可以滚动动态按钮。

代码:

root = tkinter.Tk()
root.title("Links-Shortcut")
root.configure(background="gray99")
sw= tkinter.Scrollbar(root) 
sw.pack(side=RIGHT, fill=Y)


os.chdir("C:\Bo_Link")
with open('Bo_ol_links.csv', 'r', newline='') as fo:
    lis=[line.strip('\r\n').split(',') for line in fo]        # create a list of lists
lis=sorted(lis)
    #print (lis)

for i,x in enumerate(lis):
    btn = tkinter.Button(root,height=1, width=20,relief=tkinter.FLAT,bg="gray99",fg="purple3",font="Dosis",text=lis[i][0],command=lambda i=i,x=x: openlink(i))
    btn.pack(padx=10,pady=5,side=tkinter.TOP)

def openlink(i):
    os.startfile(lis[i][1])

root.mainloop()
Run Code Online (Sandbox Code Playgroud)

谢谢。

python tkinter python-3.x

1
推荐指数
1
解决办法
8424
查看次数

标签 统计

python ×2

python-3.x ×2

batch-file ×1

c ×1

embedded ×1

netcat ×1

shell ×1

sockets ×1

tcp ×1

tkinter ×1

typeerror ×1