Outline
Terminal based Chatting Platform
Getting Started
Dependencies to Install
Concept Behind the Chatting Platform
Making the Chatting Platform
Conclusion
Future Aspects
Terminal based Chatting Platform
Getting Started
Dependencies to Install
Concept Behind the Chatting Platform
Making the Chatting Platform
import socket;
import sys;
s = socket.socket();
port = 12345;
s.bind(('', port));
s.listen(5);
print ("Server Script started")
c, addr = s.accept()
print ("Socket Up and running with a connection from",addr)
rcvdData = c.recv(1024).decode();
print (rcvdData);
sendData = input("Enter info to send: ");
c.send(sendData.encode());
import socket
import sys
s = socket.socket();
port = 12345;
s.bind(('', port));
s.listen(5);
# The infinite loop to listen to the next response from the client.
while True:
print ("Server Script started")
c, addr = s.accept()
print ("Socket Up and running with a connection from",addr)
rcvdData = c.recv(1024).decode();
print (rcvdData);
sendData = input("Enter info to send: ");
c.send(sendData.encode());
import socket
import sys
s = socket.socket();
s.connect(('127.0.0.1',12345));
str = input("Enter info to send: ");
s.send(str.encode());
recvData = s.recv(1024).decode()
print (recvData)
import socket;
import sys;
s = socket.socket();
s.connect(('127.0.0.1',12345));
# The endless loop to keep the code running and to keep interacting for a long time
# Press Ctrl+C to terminate this loop
while True:
str = input("Enter info to send: ");
s.send(str.encode());
recvData = s.recv(1024).decode()
print (recvData)
Conclusion
Future Aspects