I'm not real network savvy, so I'm struggling with this a bit. I got the web server demo working okay. Now I'm trying to construct a client-server connection between a Qt Creator Server on the PC, and a very basic client on the board. I plagiarized the demo code to init the board and then called tcpOpen() which I expected would fail if it couldn't find the server (Y/N?). Here's what's enabled in my TCPIPCONFIG.H file:
#define STACK_USE_ICMP_SERVER // Ping query and
#define STACK_USE_ICMP_CLIENT // Ping transmission capability
#define STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE // HTTP Client
#define STACK_USE_TCP_PERFORMANCE_TEST // Module for testing TCP TX
In main, I have (remember, the functions called from main() were taken from the demo):
int main(void)
{
static DWORD t = 0;
static DWORD dwLastIP = 0;
static TCP_SOCKET MySocketClient;
// Initialize application specific hardware
InitializeBoard();
// Initialize stack-related hardware components that may be
// required by the UART configuration routines
TickInit();
// Initialize Stack and application related NV variables into AppConfig.
InitAppConfig();
// Initialize core stack layers (MAC, ARP, TCP, UDP) and
// application modules (HTTP, SNMP, etc.)
StackInit();
// Allocate a socket for this client to try and perform pings
// From the internet: You_need_to_enable STACK_USE_DNS in TCPIPConfig.h to use TCP_OPEN_ROM_HOST
MySocketClient = TCPOpen((DWORD)(PTR_BASE)"169.254.13.41", TCP_OPEN_RAM_HOST, 9999, TCP_PURPOSE_GENERIC_TCP_CLIENT);
if(MySocketClient == INVALID_SOCKET)
{while(1){}};
SOCKET_INFO *remoteSockInfo;
remoteSockInfo = TCPGetRemoteInfo(MySocketClient);
etc.
The call to TCPOpen() always returns 0 (which seems to be valid when I inspect remoteSockInfo). However, it doesn't matter if the ethernet is plugged into the board or not...or whatever IP address I use in that call.
Wouldn't you expect that call to fail in those circumstances?
Thanks,
Joe B.
PS: I'm on a company PC trying to test this board, so any network snooping software (like wireshark) are not allowed...I'll be moving to a lab soon and will have more autonomy then.
EDIT: I found the source code for the GenericTCPClient.c and see that the tcpOpen() call creates the socket and is actively attempting to connect to the server. So, now I guess my question would be, will the board/socket respond to pings in this state (i.e., not connected to a server yet)?