Whenever my client connect to my server via telnet
telnet myip 43
When the client hits ctrl+c on his own machine continuously it causes the telnet server to crash... how can this be stopped ? Also are there any chances by which my server can be attacked by a buffer overflow?
This is my script(very basic script it is)
#!/usr/bin/env python
import sys
import socket
import urllib2
def main():
s = socket.socket() # Create a socket object
host = ''
BUFFER_SIZE = 2048
port = 43 # Reserve a port for your service.
s.bind((host, port)) # Bind to the port
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.listen(120) # Now wait for client connection.
while True:
data = ''
print 'waiting for connection...'
c, addr = s.accept() # Establish connection with client.
print 'Got connection from', addr
data = c.recv(BUFFER_SIZE)
print 'requested website: '+data
print x
c.send(x)
c.close() # Close the connection
if __name__ == '__main__':
main()