I'm having difficulties with socket connections. I'm trying to connect from my 7650 phone to a server via normal sockets in a similar fachion with the Symbian Series 60 SDK examples. Here is my code:
// Connect to socket server
RSocketServ ss;
TInt err=ss.Connect();
User::LeaveIfError(err);
// Open a socket
err=iSocket.Open(ss, KAfInet, KSockStream, KProtocolInetTcp);
console->Printf(_L("iSocket.Open() = %d\n", err);
User::LeaveIfError(err);
// Bind the socket to a specific local port, this actuelly
// isn't the same that shows up on the server end. Wonder why...
err = iSocket.SetLocalPort(5034);
console->Printf(_L("iSocket.setLocalPort() = %d\n", err);
// Make a connection
TRequestStatus iStatus;
iSocket.Connect(iAddress, iStatus); // iAddress holds the server name and connection port
if (iStatus.Int() == KRequestPending)
console->Printf(_L("Request is pending...\n");
else
console->Printf(_L("Status: %d\n", iStatus.Int());
The problem here is that the connection is established, but the phone doesn't seem to relize it. In this case when I set my own timer to less than timeout, the write and read methods return Not Ready. When I increase my own counter to more than the timeout value, they return Timeout. I followed the packet stream to analyze the discussion of server and phone. Here are my findings as TCP stream (SYN = Synchronize, ACK = Acknowledge):
1. The phone send a SYN to the server
2. Server responses with ACK and it's own SYN
3. Phone responses with ACK to the servers SYN
According to RFC specifications of TCP protocol this is when the connection is regarded as established, which is seen on the server side. But the next packet from phone is a SYN-packet instead of a normal data package. So the phone starts everything all over again. This is when the packet stream gets messy and sometimes the server calls for RES (reset) and sometimes the phone does it also.
The emulator didn't even do that much.
I also tried the Series 60 Sockets example but with no luck. So I'm asking is has ANYONE got the sockets working on the actual phone? If so, I would be more than happy to see that code and probably get a description about how it works. Or even get succestions for changes in the code.
Thanks in advance,
Tapio
RE: Socket connection with 7650
2002-09-03, 08:20#2
Hi,
i'm interested of the same issue.I've some problems in running the Socket example on the emulator because i've an error message like error -33timeout. In this way the connection is refused, if you solved the problem of running Socket example can you help me?
Thanks in advace.
Best regards.
RE: Socket connection with 7650
2002-09-04, 09:15#3
Let me quote from a letter found at Forum Nokia - Symbian - Symbian Tools & SDKs :
---- Quotation begins
Dear Developers,
I have now talked with the people at Degel Software Ltd about publishing their modified cdbv2.dat file and they agreed.
So, to get RAS working with the 0.9 SDK, please download the cdbv2.dat file at:
http://www.digstud.se (Choose Symbian to the left)
I think everyone interested in making network-enabled-software will appreciate the efforts that David Jacobson at Degel Software put into this issue. (http://www.degel.com)
And again, I hope that Nokia will provide a working toolkit for the next release.
Best Regards,
/Patrik Strmstedt
patrik@digstud.se
---- Quotation ends
I downloaded that comms db and it works!
tOtE
RE: Socket connection with 7650
2002-09-04, 09:15#4
Let me quote from a letter found at Forum Nokia - Symbian - Symbian Tools & SDKs :
---- Quotation begins
Dear Developers,
I have now talked with the people at Degel Software Ltd about publishing their modified cdbv2.dat file and they agreed.
So, to get RAS working with the 0.9 SDK, please download the cdbv2.dat file at:
http://www.digstud.se (Choose Symbian to the left)
I think everyone interested in making network-enabled-software will appreciate the efforts that David Jacobson at Degel Software put into this issue. (http://www.degel.com)
And again, I hope that Nokia will provide a working toolkit for the next release.
Best Regards,
/Patrik Strmstedt
patrik@digstud.se
---- Quotation ends
I downloaded that comms db and it works!
tOtE
RE: Socket connection with 7650
2002-09-04, 10:48#5
You have problems with sockets both on the emulator and the hw. Well, unfortunately I cannot tell you the perfect solution, I can only give you some advices.
First, I don't know this setupcomms.bat, but I would have used commsdb_ras.cmd instead. This way, you get a comms db set up for RAS communication. After executing this batch file, I would replace the comms db (cdbv2.dat) by the one suggested by Patrik. After this, the RAS should work.
Hw : when you tell your socket to connect to a remote host, the system (the socket server?) first checks whether there's already an active connection. If there is, then it uses that connection. If there isn't, then it pops up a dialog containing the available access points (APs) and you can (and must) choose from them.
AFAIK, it's possible to specify the characteristics of the AP to be used by code (so you needn't choose an AP from the list manually). This can be done by using the default AP from the comms db. If the settings of the default AP don't satisfy your needs, then you're free to modify them by using the RGenericAgent class in agentclient.h. This way, you can override the important settings. Note : I haven't used this class yet, but I'm planning to use it.
Hope it helps,
tOtE
RE: Socket connection with 7650
2002-09-06, 07:22#7
The example "Sockets" in Symbian/6.1/Series60/Series60Ex/Sockets can be used as a simple telnet program using null modem cable connected to COM1 for dial out by emulator and COM2 for accept incoming connection by RAS.
You have to replace cdbv2.dat which is provided by tote.
Just make sure that same baud rate is used for COM1 and COM2.
RE: Socket connection with 7650
2002-09-06, 07:31#8
The example in Symbian/6.1/Series60/Series60Ex/Sockets can be used as a simple telnet program using null modem cable connected to COM1 for dial out by emulator and COM2 for accept incoming connection by RAS.
You have to replace cdbv2.dat which is provided by tote.
Just make sure that COM1 and COM2 are configure the same baud rate if you are using NULL modem cable.
RE: Socket connection with 7650
2002-09-06, 09:58#9
Hi,
i'm tryng to modify the socket example in a way that i can fix the accesss point with the configuration of the GPRS APN i'd like to use.
I don't know where in the socket framework the calling to the RGenericAgentClass is. I understood that RGenericAgentClass take the information from the commsdB. In a real HW phone the application allows us to choose among the connection setting(the commmsdB of the phone i image).So if i know where this calling is i can use a function of RGenericAgentClass like:
TInt StartOutgoing(CStoreableOverrideSettings& aOverrides)
This function can overwrite the settings and open a specified APN.
At this point the socket application used the APN opened.
It is correct?
Thanks in advance
RE: Socket connection with 7650
2002-12-25, 07:27#10
I use the example sockets in series60ex.It also failed.And i use socket bench to listern the port 80.It told me:"connection failed by time out or other error.And I can use webview.And some one run the example well.so i thinks the wrong is in GateWay.Do you have any advices?Thanks.
RE: Socket connection with 7650
1970-01-01, 02:00#11