Code Monkey home page Code Monkey logo

chatdemo's Introduction

首先编译两个Demo

都编译通过后,先打开server demo之后不用管了
接下来只用操作client demo
多开client demo
实现client之间互相传文件以及文字交流 (端对端通信)

实现都是先客户端发给服务端,服务端在转发给相应客户端

现server demo绑定的是本地环回地址即127.0.0.1,端口是1997
client demo也默认去连接该地址端口, !!!没有做ip端口的组件,可自己实现!!!
还有这个只是简单的tcp通信,没有做超时处理,(即客户端如果连接不上服务端时会有一个超时,默认是10秒左右,可以用select函数自己实现一个超时连接)
由于时间问题暂时没做,暂时可以不用,有兴趣研究下去可以去搜下select函数,之前有实现过一个类似的函数,不想找了,就这样也可以了

默认传文件时服务端接受到文件将其存在和服务端同一目录下
客户端接受文件有一个弹窗是否接收,如接收则默认存在和该客户端同一目录下
如不接受则不接受,取消即可

chatdemo's People

Contributors

bottod avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.