wifi chat on android

后端 未结 1 1163
盖世英雄少女心
盖世英雄少女心 2021-01-16 21:01

Is Wifi chat is possible on android?

My requirement is my Pc thats connected with a wifi dongle and my android device has wifi. I want to convert my pc to server and

相关标签:
1条回答
  • 2021-01-16 21:42

    Obviously it's possible. To start with, you could make a peer-to-peer chat over UDP, hard-coding each other's IP numbers into the other's programs. A few lines of python on the PC, a few lines of Java on the Android. Then you could start adding the functionality you need to make it client-server: add a broadcast listener on the PC, so that it can auto-detect clients, then you can eliminate the schlock hard-coded IP numbers. And build up from there.


    Example server-side in Python:

    jcomeau@intrepid:/usr/src/xmlvm.svn$ python
    Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
    [GCC 4.4.5] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import socket
    >>> chatter = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    >>> chatter.bind(('192.168.1.121', 9999))
    >>> chatter.sendto('this is a test', ('192.168.1.144', 6666))
    14
    
    0 讨论(0)
提交回复
热议问题