Python Forum

Full Version: How to use a UDP server and client to setup a chat
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
well i am just learning python and i know this is complicated... maybe... idk, but what i am trying to do is: lest say i want to talk to someone on another windows from my mac OS X and i want to use terminal to send a message to a udp server, and it sends the message to the other computer. kinda like a chat service. this is basically the way E-mail works. you send a message from client to server. then the server sends the entry from the first client to the second. I'm planning to setup on the MAC OS X  the server and a client and on the windows a client. and if i wanted to add more clients how would i do that?


so what i am trying to say is.

1. how do i setup a udp server and client
2. how to i make it where multiple clients can log into the server and see messages sent from one client to another?
3. be able to add more clients that can use the server


if you can't understand what I'm trying to make, lust let me know and i will try to clarify. remember I am currently running a mac and the command line is the same as a linux and I also have a windows 10 computer. I
How much of this do you want to write yourself? If you use Twisted, you can have a basic udp client and server done very quickly.

A server doesn't have any clients at first. Clients connect to it, and register themselves as listeners. So adding a second client is exactly as difficult as adding the first.
ok i plan not to do much in setting it up. my main thing I'm learning right now is C++ and ill get to python later. just trying to setup an echo server like listed on twisted... but it returns whats sent to other clients... the server is there to just allow people to connect to each other, and to send messages it received by clients to other clients... so was i want is for the clients to be able to write AND receive. how would i do that
(Mar-08-2017, 09:38 PM)nilamo Wrote: [ -> ]How much of this do you want to write yourself? If you use Twisted, you can have a basic udp client and server done very quickly. A server doesn't have any clients at first. Clients connect to it, and register themselves as listeners. So adding a second client is exactly as difficult as adding the first.