I'm sorry i don't know if this is the right place to ask for that.
I have a thread. The main thread.
I use it as a server. I use overlapped and completion ports winsock
functions.
Everything works fine (works perfectly to be clear).
If i try to cut & paste the main infinite loop (wait for a client to
connect, then accept it) into another *empty* procedure and call it from
the main procedure (TThread.Execute), when I call WSAAccept() there's an
error !
WSAGetLastError returns (I translate, I'm sorry I'm French) :
"the system has detected a non valid pointer address when trying to use a
pointer argument in a procedure call".
There's no pointer at all :
NewSocketClient := WSAAccept(FSocketListen, InternetAddr, nil, nil, 0);
with
FSocketListen : TSocket;
NewSocketClient : TSocket;
InternetAddr : TSockAddrIn;
This is so weird ! I'm stuck.
The same code in TThread.Execute works only in TThread.Execute !
What is more strange is that all the other procedure calls still work
perfectly (allocate socket, bind it and so on)
Any idea ?