Well, I tried ignoring the returned error and assuming the socket connect()s properly. It didn't work. send() reports that the correct number of bytes are sent, but I see no ethernet activity on the switch port the mbed is connect to and nothing on my server.
I checked the HTTPclient example and after sorting through its 3000 layers of abstraction found that it was doing the same thing I am. So I'm stumped.
For reference, I'm currently trying to connect to a Linux box running "netcat" using `nc -v -v -l -p 6668`. Netcat never reports any connection attempt. Am I missing something such as an off-by-one on how the ports are numbered? Is there some trick to specifying the IP address of the host I'm trying to connect to?
Host host( IpAddr( 192,168,0,100 ), 6668, NULL );
Is there anyone else who has tried to use TCPSocket? Thanks for any help that comes my way.
Regarding the dynamic instialization of the Ethernet interface; I'm just following the examples. I don't have any documentation so I'm copying as much from the examples as possible. If by 'dynamic' you mean DHCP, then 'yes' because I want DHCP support. Eventually I'll use the DNS query stuff too, but I was trying to remove possible causes of error. If there is a simpler way of doing what I'm trying to do, I'll try it. If you mean not declaring them as globals and using the `new` keyword, it was because that was the way the examples did it, so I assumed they knew something about the compiler that I didn't (which is a lot: I know very little about what the compiler is doing in this case).
"Connect to a host and send a few bytes" should be about 6 lines of code. I think it'd make a great example. Right now the examples are all very specific to Twitter, SQL, etc.
I'm trying to get my mbed to connect to a telnet server and exchange some data. I've searched the forums and read the source code, and can't find a reason why this shouldn't work:
In TCPSocket.h, this is commented as "Not enough mem". Somehow that seems very unlikely, considering there is nothing else to this program!