title: Python socket connection between Windows and Linux
body: <p>I can't set up a socket connection between a Linux and a windows machines
  I don't know why is the client not accepting the connection and the server is just sitting there waiting for a client i don't know what's the problem
  i tried using different ways to get the host but still a problem this code would work from a Linux OS to a Linux OS but not from a Linux to Windows or vice versa.</p>
  
  <p>server code:     </p>
  
  <pre><code>import os #importing the os module
  
  import socket #importing the socket module
  
  store_folder  = "socket_info7" # assigning the variable store_folder to the value "socket_info"
  
  os.mkdir(store_folder) #using the variable value to make a folder named socket_info
  
  os.chdir(store_folder) # changing the directory to socket_info
  
  store_file = store_folder+" 1"
  
  store_file  = open(store_file,"a") # make a file named socket_info
  
  s= socket.socket() # making a socket object 
  
  host  = socket.gethostname()
  
  port  = 5000
  
  s.bind((host,port))
  
  s.listen(1)
  
  while True:
  
      c,addr  = s.accept()
  
      user_input  = raw_input("write")
  
      c.send(user_input)
  
      if user_input == "q":
  
          break
  
  s.close()
  </code></pre>
  
  <p>client code:</p>
  
  <pre><code>#!/usr/bin/python           # This is server.py file
  
  import socket               # Import socket module
  
  s = socket.socket()         # Create a socket object
  host = socket.gethostname() # Get local machine name
  port = 5000               # Reserve a port for your service.
  s.bind((host, port))        # Bind to the port
  
  s.listen(5)                 # Now wait for client connection.
  while True:
     c, addr = s.accept()     # Establish connection with client.
     print 'Got connection from', addr
     c.send('Thank you for connecting')
     c.close()                # Close the connection
  </code></pre>