0

hi all
I'm writing a application which uses Opencv and wxWidgets and sends camera frames via a socket connection. But it seems i'm doing something wrong: after starting a server on my machine, i can't connect my application to the socket the server is listening on...why is that?

import socket 
client=0
 
class SockClient():
    def init1(self,ip,port):
        global client
        client=socket.socket ( socket.AF_INET, socket.SOCK_STREAM) #initiating socket 
        client.bind((ip,int(port)))
        client.settimeout(1)
  
   def kill(self):
         global client
         client.close()
   
   def send(msg,type):
         global client
         if (type==1):
              client.send(type+"#!/"+size+"#!/"+msg)
         elif (type==2):
              print 'not implemented yet'
         elif (type==3):
              print 'not implemented yet'
         else:
              print 'not a valid message type'

this is the error i get:

Traceback (most recent call last):
  File "main.py", line 94, in OnConnect
    client.init1(self.ipBox.GetValue(),self.portBox.GetValue())
  File "/mnt/misc/work/cd/src/sockComm.py", line 9, in init1
    client.bind((ip,int(port)))
  File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by breakbone
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.