I am having peculiar difficulties with infrared sockets. I have
created a simple application that sends and receives data via an
infrared socket connection, acting either as a server (listening on a
socket) or a client (doing the discovery). A similar application
exists for Windows as well. The problem is that the infrared socket
connection between two Symbian devices or between two Windows machines
works perfectly, but when the machines are mixed the data flows only
to Symbian device but not to the Windows machine. The situation is the
same regardless which device (Symbian or Windows) is acting as a
server or what versions of Windows (NT, 2000, 98) or Symbian devices
(9210, 7650) are used.
At this point I am not sure whether the culprit is the Symbian or
Windows application, but I would like to know whether anyone has
succeeded in creating a working two-way irda socket connection between
a Symbian device and a Windows machine.
TInt err = iSocketServ.FindProtocol(protoName, proto);
if (err)
return EFalse;
err = iListenSock.Open(iSocketServ, proto.iAddrFamily, proto.iSockType, proto.iProtocol);
if (err)
return EFalse;
TIrdaSockAddr iAddress;
// not sure if you can just omit setting the port
int port = 4;
iAddress.SetPort(port);
err = iListenSock.Bind(iAddress);
if (err)
return EFalse;
if (stat1.Int()==KErrNone) // TIMER COMPLETED - IAS QUERY
{ // REQUEST HAS TIMED OUT.
aIAS.Cancel();
return KErrNotFound;
}
tim.Cancel();
if (stat2.Int()==KErrNone) // IAS QUERY COMPLETED OK.
{
switch(results.Type())
{
case EIASDataMissing: // Missing
break;
case EIASDataInteger: // Integer
TInt num;
if (results.GetInteger(num)==KErrNone)
return TUint8(num);
else
{
// Bad type
}
break;
case EIASDataOctetSequence: // Byte sequence
//results.GetOctetSeq(res);
//DumpBuf(res);
break;
case EIASDataUserString: // String. Use
break; // results.GetCharString8()
// to get string
default: // Bad type
break;
}
}
else if (stat2.Int()!=KErrNone) // IAS QUERY COMPLETED
{ // UNSUCCESSFULLY.
switch (stat2.Int())
{
case KErrUnknown: // No such attribute
break;
thank you for your code first
but when I integrate it to my code,complie and run
and the problem occured.the debugger poped(vc6)
and if i chose to go on,the "kenal erroe..."will pop in the emulator
the problem is the same with the code in the sdk
"How to create a simple beaming application"
why is that?
Thanks!
to bobline:when I use irComm,pc side can not receive anything
from 7650,though connection is set.and do you install irComm drivers for 2000 and xp?if not, irComm still work?
thanks!
Do you mean IrCOMM as with an emulated
serial port on the PC? I have never tried that.
I'm not sure you can use IrCOMM with
IrDA sockets on symbian, I think you have
to use the serial driver.
Hi can anyone help me out? i trying to use the simple beaming application and try to run the send program but then it crash as it cannot open the RHostresolver even though i put in the right parameters. Does anyone noe why? and could anyone be kind to post out their full workable infra coding?
I've been having similar problems, and I wondered if anyone might be able to help?
I've been trying to send data between a pc (winxp) and a nokia 3650. I've been through the posts on this forum and I've managed to get some stuff working.
I have a server running on the PC which opens a socket and binds it to an address...
The client runs on the phone, and discovers the PC and finds the port using IASQuery (from the API reference), with "MyIrDAService" as the classname, and "IrDA:TinyTP:LsapSel" as the attribute.
I can then connect the socket to that address/port, and that all works fine. On the PC, accept completes and it all looks like everything's going well... but then I try and send stuff!
to send some data to the PC, and on the PC I just call
len = recv(client_sock, buf, sizeof(buf), 0);
on the connected socket. The send call returns, and WaitForRequest returns ok - and I can do that several times with no problem. recv never returns though... at least not until the client closes the socket, at which point it returns 0 (I don't get any errors from WSAGetLastError() either).
Does anyone have any ideas why I might be able to establish a connection, but not be able to actually receive any data, even though the send seems to be working?
I think I've gone some way to solving this... I was using some example code from msdn for the server, and that code was setting some IrCOMM IAS attributes. As the IAS entry already exists (or at least I think it should do), there's no need to do that, and in fact messing about with it seems to break it
So, I just took that code out and now I can receive some data from the phone. Currently not everything I send get received, but it's better than it was!
Anyway, thought I'd post this in case anyone else has this problem.
Sounds like many of us have struggled with the same problems. I've been trying to get a simple send/receive application between a 3650 and a WinPC to work for sometime now. Very frustrating! I wish the Symbian documentation was better.
My server runs on the PC and the client on the 3650. At this point I can discover the server, query my service using IAS and connect to it from the 3650. So far, so good. But I can't seem to be able to send or receive anything. Send just hangs (never returns) and receive returns with error -5 (NotSupported)! As far as I know, I'm doing nothing special that should cause this failure. Any help would be much appreciated.
A second question, I tried discovery using the HostResolver and the Ioctl discovery indicator. If there is no peer, HostResolver returns with an error immediately, which means I need to loop constantly. The Ioctl blocks until a peer is discovered (good) but then the socket connect fails (bad)! Any insights?
My PC server is your basic code:
- load winsock
- create socket
- bind
- listen
- accept(new sock)
- send/recv on new sock
The 3650 code is:
- connect to socket server
- force load of TinyTP protocol
- open socket
- open host resolver
- get by name
- do IAS lookup, set address
- connect
- send/recv on socket