1
파이썬에서 msvcrt.kbhit()을 사용하여 지정된 키를 눌렀을 때 데이터를 어떻게 인쇄 할 수 있는지 생각해 냈습니다. 루프가 다시 한 번 루프를 돌면서 내 욕구를 출력 할 수있는 것처럼 보입니다. 누군가 나를 도울 수 있습니까? 일부 데이터가 수신 될 때까지 + getch
kbhit
을 실행하지 않도록 recv
전화에 프로그램 블록 대부분의 시간을kbhit로 파이썬 소켓 스레딩
def run(self):
global state
print "\nClient connection received!\n"
self.channel.send("Status: Server connection received")
while 1:
ctr = 1
while 1:
self.clientmess = self.channel.recv(Buffer)
if msvcrt.kbhit():
if msvcrt.getch() == 's':
print "stop"
break
#the codes belo is what i will want for self.clientmess will be so its not necessary I think to put
정확히 무슨 문제입니까? – wRAR
코드가 클라이언트에서 데이터를 수신 할 때 키보드의 's'키를 누르면 인쇄 중지가 인쇄되지 않고 화면에 인쇄 할 "인쇄 중지"전에 다른 데이터가 필요합니다 –