×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    22

    socket.recv problem

    hi guys,

    i am having a problem with socket.recv.

    Code:
    def readAndSend():
    	global btSocket
    	data_received = 0
    	while(data_received == 0): #while there is not data, monitor channel
    		channel = btSocket.recv(1)
    		print u"got socket"
    		buffer = ""
    		while(channel != '\n'):
    			buffer += channel
    			channel = btSocket.recv(1)
    			
    		if(buffer[0:6] == "$GPGGA"):
    			data = buffer.split(",")
    			latitude = data[2]+data[3]
    			longitude = data[4]+data[5]
    			
    			data_received = 1
    		
    			btSocket.close()
    I am running this script every 30 seconds and it works the first time, however when it goes to run again it hangs at the first recv. This happens even if I close the socket then reconnect.

    Is there anyway to get round this?

    Thanks

    docGroup

  2. #2
    Registered User
    Join Date
    Oct 2007
    Posts
    22

    Re: socket.recv problem

    just to let you know, this was solved by putting the connect and readData in one big method, instead of split up. Not sure why this solves it, but hey!!

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •