DirectPlay connect to a server error

Started by
1 comment, last by BigBeginner 18 years, 4 months ago
Hi there, I'm working on a network program. The server creating and ennumerating is ok, but I'm trouble with connecting to a server. Here is the code (delphi, the C++ coders will understand it): const GGGG : TGUID = '{83783300-4063-4c8a-9DB3-82830A7FEB31}'; var TargetHost : IDirectPlay8Address; Host : pwchar; begin DirectPlay8AddressCreate (GGGG, TargetHost, nil); // THE "GGGG" CONTAIN THE GUID OF DIRECTPLAY8ADDRESS. Getmem (PORT, 4); PORT:= pwchar(Target.Port); Getmem (HOST, 255); FillChar (HOST^, 255, 0); StringToWideChar ('192.168.144.113', HOST, 253); TargetHost.SetSP(@CLSID_DP8SP_TCPIP); TargetHost.AddComponent(DPNA_KEY_PORT, @PORT, sizeof(DWORD), DPNA_DATATYPE_DWORD); TargetHost.AddComponent(DPNA_KEY_HOSTNAME, HOST, 255, DPNA_DATATYPE_STRING); end; And here, the "TargetHost.AddComponent(DPNA_KEY_HOSTNAME, HOST, 255, DPNA_DATATYPE_STRING);" sends back an error message: 'One or more of the parameters passed to the method are invalid.' What can I do? I visit Micro$oft MSDN, and some codes, everyone connect to the server like this. This is an server/client architect. The address doesn't want to accept the host adding.
Advertisement
My advice would be switch to sockets. DirectPlay is basically obsolete, or will be by the time your app is complete :)

There are many online resources for winsocks, if your running windows?

I switched, and haven't looked back!

Good Luck!

Si
Yes, if the hell freezes, I will. The error can be the host name, but I don't know what about it... I get some memory for it, convert an IP address to unicode. I think DP doesn't like my host name, but why? I saw some C code, and all do it like this.

This topic is closed to new replies.

Advertisement