If your server works fine using the emulator as your client it seems like it's a networking issue, and not a code issue.
BTW, DON'T mix network code and UI code. Read: http://developer.android.com/resources/articles/painless-threading.html On Tue, May 17, 2011 at 3:10 PM, ingy abbas <[email protected]> wrote: > import sys > from threading import Thread > import socket > import MySQLdb > > allClients=[] > > class Client(Thread): > > def __init__(self,clientSocket): > Thread.__init__(self) > self.sockfd = clientSocket #socket client > self.name = "" > self.nickName = "" > > def newClientConnect(self): > > allClients.append(self.sockfd) > while True: > > > while True: > > try: > rm= self.sockfd.recv(2048) > print rm > i=0 > > while (i<2): > > if (rm) == row[i][0]: > reply="\n Welcome to our game %s: %s"% > (rm,row[i][1]) > self.sockfd.send(reply) > break > > else: > > i=i+1 > if i==2: > reply="\n Error opaa ba2a" > self.sockfd.send(reply) > i=0 > break > break > > except ValueError: > self.sockfd.send("\n UNVAlied Comment ") > > > def run(self): > self.newClientConnect() > while True: > buff = self.sockfd.recv(2048) > if buff.strip() == 'quit': > self.sockfd.close() > break # Exit when break > else: > self.sendAll(buff) > #Main > if __name__ == "__main__": > > #Server Connection to socket: > IP = '50.0.10.107' > PORT = 5807 > serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > serversocket.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, > 1 ) > print ("Server Started") > try: > serversocket.bind(('',54633)) > except ValueError,e: > print e > serversocket.listen(5) > > > db= MySQLdb.connect(host= "localhost", > user="root", > passwd="newpassword", > db="new_schema") > > cursor = db.cursor() > > sql="""CREATE TABLE try (COL1 VARCHAR(45), COL2 VARCHAR(45), PRIMARY > KEY (COL1)) """ > cursor.execute(sql) > > > #insert to table > cursor.execute("""INSERT INTO try VALUES (%s,%s)""",("opa","myghost")) > db.commit() > #db.rollback() > #show table > #cursor.execute("""SELECT * FROM try""") > print cursor.fetchall() > db.close() > > > > > print "Connected to the Database" > > while True: > (clientSocket, address) = serversocket.accept() > print 'New connection from ', address > ct = Client(clientSocket) > ct.start() > > > > > __all__ = ['allClients','Client'] > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- ~ Jeremiah:9:23-24 Android 2D MMORPG: http://solrpg.com/, http://www.youtube.com/user/revoltingx -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

