我如何通过手机访问我的电脑



我无法通过手机访问我的电脑

我的简历

import socket
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput

UDP_IP = ""
UDP_PORT = 80
MESSAGE = ""

anaDuzen = BoxLayout(orientation = "vertical") # Elemanların hepsini tutan ana pencere düzenimiz

ilkSatir = BoxLayout()
ikinciSatir = BoxLayout()
ip_txt=TextInput()
textdeneme=TextInput()
buton = Button(text = "Giriş Yap")

def onpresone(instance):
MESSAGE=textdeneme.text
UDP_IP=ip_txt.text
try:
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.sendto(bytes(MESSAGE,'utf-8'), (UDP_IP, UDP_PORT))
except: 
pass
textdeneme.text=''

buton.bind(on_press=onpresone)
class Program(App):
def __del__(self): 
pass
def build(self):
anaDuzen.add_widget(ip_txt)
anaDuzen.add_widget(textdeneme)
anaDuzen.add_widget(buton)
return anaDuzen
#Program().run()
obj=Program()
obj.run()

------我的服务器


import socket
UDP_IP = "192.168.42.16"
UDP_PORT = 80 #20,21
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDPcmd
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print ("received message:", data,addr)

我无法通过手机访问我的电脑那我该怎么办?我的代码或手机出现错误,我就是无法理解。我可以在电脑上访问虚拟系统,但不能在手机上访问。

如果你帮忙,我会很高兴的。非常感谢。

添加

--permission INTERNET

到你的.p4a文件。默认情况下,不允许连接到网络。

最新更新