Using latest fltk-2.0-r6786 on WinXP I can't get add_fd() system working. I
setup a tcp server and add it to fltk system using add_fd(). But when I connect
for example with telnet client no one calls the callback function and in my
code nothing gets printed. Here's the code:
#include <iostream>
#include <fltk/run.h>
#include <fltk/Window.h>
#include <winsock2.h>
void sockReadCB( int sock, void* param )
{
SOCKET a = accept( sock, 0, 0 );
closesocket( a );
std::cout << "sockReadCB: " << sock << ", " << param << std::endl;
}
int main()
{
WSAData wsdt;
WSAStartup( 0x202, &wsdt );
SOCKET sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
sockaddr_in addr;
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_port = htons( 2000 );
addr.sin_family = AF_INET;
bind( sock, (sockaddr*)&addr, sizeof( sockaddr_in ) );
listen( sock, 1 );
fltk::add_fd( sock, sockReadCB );
fltk::Window w( 100, 100, 100, 100, "Test" );
w.show( );
fltk::run( );
WSACleanup( );
return 0;
}
Thanks for help.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk