Opening and writing to an ISocket | developer.brewmp.com Opening and writing to an ISocket | developer.brewmp.com

Developer

Opening and writing to an ISocket

Forums:

Hi,

My code looks something like the following:

 

ISHELL_CreateInstance(pMe->piShell, AEECLSID_NET, (void**)&pMe->pINetMgr); pMe->pISocket = INETMGR_OpenSocket(pMe->pINetMgr, AEE_SOCK_STREAM); nRet = ISOCKET_Connect(pMe->pISocket, INETMGR_GetMyIPAddr(pMe->pINetMgr), AEE_htons(port), afterConnecting, (void*)pMe);   nRet = ISOCKET_Write(pMe->pISocket, send, 1);

 The first three lines don't return an error but I do get error 0x210 on the 4th line which means that the socket is not connected. The ISOCKET_Connect call returned without an error. However, the callback function "afterConnecting" gets called.  I was pretty sure that the IP address was causing the problem and when I checked what INETMGR_GetMyIPAddr returned, I was surprised to find that it was the value 0. However, when I include a valid IP address in the correct format, I get the same result. Does anyone have any clues as to what might be going on?

I am running this on the Simulator with Brew MP Toolset 7.10 Rev 10.0.1489821 and Platform 1.0.2.547. 

 

 

Connecting is verified in the callback.  You don;t want to try reading/writing until connection
is complete.  Looks like you are calling ISOCKET_Write with a potentially unconnected socket.

Connecting is verified in the callback.  You don;t want to try reading/writing until connection
is complete.  Looks like you are calling ISOCKET_Write with a potentially unconnected socket.

jmiller2_ is correct, ISOCKET_Connect is an asyn function, you should wait until afterConnecting is called, you cannot call write or read until the connection is established

jmiller2_ is correct, ISOCKET_Connect is an asyn function, you should wait until afterConnecting is called, you cannot call write or read until the connection is established