Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Oct : So strange : non valid pointer address error

www.cryer.info
Managed Newsgroup Archive

So strange : non valid pointer address error

Subject:So strange : non valid pointer address error
Posted by:"Olivier Pons" (olivier.pons@f.r.e.e.fr.remove.unnecessary.dots.com)
Date:Thu, 20 Oct 2005 20:36:18 +0200

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 ?

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive