gamecreator Posted July 11, 2010 Share Posted July 11, 2010 It seems this comes up from time to time but does anyone have a basic network example they could share? I'm stumped right from the start. All I'm trying to do is send integers back and forth from host to client and reverse. Even putting this in THost host; host = CreateHost(0,80,2); results in: error LNK2019: unresolved external symbol "unsigned char * __cdecl CreateHost(int,int,int)" (?CreateHost@@YAPAEHHH@Z) referenced in function _main What does that mean? Any help would be really appreciated! Quote Link to comment Share on other sites More sharing options...
Mumbles Posted July 11, 2010 Share Posted July 11, 2010 LNK2019 means that CreateHost has been declared, but the linker cannot find where that function is defined. As I don't use the Leadwerks networking commands, I wouldn't know what you would need to include to fix it Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Laurens Posted July 11, 2010 Share Posted July 11, 2010 I think you need to include netwerks.cpp. Not sure though, have not yet gotten to networking in my project. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted July 11, 2010 Author Share Posted July 11, 2010 I added netwerks.cpp and it compiled then crashed but thank you both! That's one step forward. (I was under the impression, by the way, that including netwerks.h would cover this but it seems I was wrong.) Quote Link to comment Share on other sites More sharing options...
Canardia Posted July 11, 2010 Share Posted July 11, 2010 You need initialize Netwerks also using InitializeNetwerks() and at the end terminate it using TerminateNetwerks(). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
gamecreator Posted July 12, 2010 Author Share Posted July 12, 2010 Thank you. Added it. Still crashed. But now the console says that netwerks.dll failed to load. I tried to find the dll but it doesn't seem to come with the program. Very odd. On a side note, for those like Lumooja who seem to be familiar with this: how did you learn? Is there a resource outside of the wiki and related documentation that I'm missing? Nothing mentions functions like InitializeNetwerks() and TerminateNetwerks() that I could find, for example. Quote Link to comment Share on other sites More sharing options...
TylerH Posted July 12, 2010 Share Posted July 12, 2010 Networking commands were removed from the DLL in the latest SDK from what I recall. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Mumbles Posted July 12, 2010 Share Posted July 12, 2010 If this is the case, that would make sense as to why the linker can't find the code definitions So I guess the solution for this issue is the usual: use a third party lib like RakNet Edit: Or, you could define it yourself... THost CreateHost(int ip, int port, int players) { printf("Thank you Mumbles, you made the linker error go away!\n"); return NULL; } Of course, you can't do any networking with that - but it should make the linker error away... Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Canardia Posted July 12, 2010 Share Posted July 12, 2010 It seems Josh forgot to include netwerks.dll in the 2.32 installer, but you can get it from 2.30 or 2.31. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
gamecreator Posted July 12, 2010 Author Share Posted July 12, 2010 Good thought. I haven't updated in a bit though so I think I actually have 2.30 (at work now so I can't check) so it seems it hasn't been included in some time. That's actually what I was trying to PM Josh about (see Recent Status Updates on main Forum Page). Darn. enet is undocumented. RakNet is a bit complicated for me. Leadwerks networking is undocumented and kind of half broken. Bleh. Thank you for everyone's help though. It truly is appreciated more than you know. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted July 19, 2010 Author Share Posted July 19, 2010 Alright! Finally getting up and running on the netwerks front. Josh was kind enough to update the SDK to include the DLL. I can now get it running but it crashes on TerminateNetwerks(), after user presses ESC. If I comment out that line, the program exits properly. At this point my program is super simple. #include "engine.h" #include "netwerks.h" int main() { if(!Initialize()) return 1; InitializeNetwerks(); RegisterAbstractPath("D:/Programming/Leadwerks Engine SDK"); // Set graphics mode Graphics(320,40); // Create framework object and set it to a global object so other scripts can access it TFramework fw = CreateFramework(); // Set Lua framework object SetGlobalObject("fw",fw); // Set Lua framework variable BP lua=GetLuaState(); lua_pushobject(lua,fw); lua_setglobal(lua,"fw"); lua_pop(lua,1); // Get framework main camera TCamera camera = GetLayerCamera(GetFrameworkLayer(0)); PositionEntity(camera,Vec3(20,60,-50)); RotateEntity(camera,Vec3(45,0,0)); TLight light=CreateDirectionalLight(); RotateEntity(light,Vec3(45,45,45)); THost host; host = CreateHost(0,80,2); SetStats(0); while(!KeyHit(KEY_ESCAPE)) { UpdateFramework(); RenderFramework(); DrawText(0,0,"Host Keys: "); DrawText(0,20,"Peer Keys: "); Flip(0); } exitapp: TerminateNetwerks(); // Crashes here if this line isn't commented out return Terminate(); } I removed the error checking to make things as easy as possible. Any ideas why it would crash? Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 19, 2010 Share Posted July 19, 2010 wouldn't you need to disconnect/free the host before you terminate netwerks? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Canardia Posted July 19, 2010 Share Posted July 19, 2010 You need need to initialize netwerks before the engine, and terminate it after the engine. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Mumbles Posted July 19, 2010 Share Posted July 19, 2010 You need need it initialize netwerks before the engine, and terminate it after the engine. Really? I thought it relied on the entity system... Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Canardia Posted July 19, 2010 Share Posted July 19, 2010 Networking is not only for entities, it's basically just a hack to exchange data because not all computers are tied together via the same RAM memory. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
TylerH Posted July 19, 2010 Share Posted July 19, 2010 Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
gamecreator Posted July 19, 2010 Author Share Posted July 19, 2010 Thank you Lumooja! Appreciated as always. Small steps forward... Quote Link to comment Share on other sites More sharing options...
Mumbles Posted July 19, 2010 Share Posted July 19, 2010 Networking is not only for entities, it's basically just a hack to exchange data because not all computers are tied together via the same RAM memory. I didn't say I thought it was just for entities. I meant I thought it used the entity messaging system as a way of transporting data around. But in any case, you knew the answer to the question. Have you been playing around with it. Or was it just part of your infinite knowledge? Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Canardia Posted July 19, 2010 Share Posted July 19, 2010 It's only esoteric knowledge, since I wrote also the netwerk headers and noticed this behaviour while testing it The reason is probably somewhere deep inside the way how BlitzMax's garbage collection works, and it will be fixed when LE 3.0 is written in C++. Garbage Collection languages allow so many hidden bugs that you can never know how many bugs your program still has, since it doesn't crash immediately but completely randomly depending on time. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Rick Posted July 19, 2010 Share Posted July 19, 2010 Use RakNet. Seriously, you won't regret it and there is good documentation around it and it's really not hard. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted July 20, 2010 Author Share Posted July 20, 2010 Have you seen the tutorials? They're hardly brief, easy-to-understand-at-first-glance snippets. Even though they're broken up into what should be small segments, like "Creating Packets," each page is stuffed with rules of things you must and can't do to make sure your program works. Hardly an indication of a friendly engine. Quote Link to comment Share on other sites More sharing options...
Rick Posted July 20, 2010 Share Posted July 20, 2010 I have seen the tutorials. I have used them to get networking working. If I'm able to get it working anyone can, trust me. You will get more out of RakNet than LE's current networking API. I thought RakNet was overwhelming at first too, but one you see how BitStreams work, it's very simple actually. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted July 20, 2010 Author Share Posted July 20, 2010 Rest assured that RakNet is a close second on my list. If I crash and burn with Netwerks, it is where I'll turn. I've looked at enet as well (what I understand Netwerks to be built on top of) and though I like its documentation the most of the three, it doesn't seem to have a visible community behind it (does it even have a forum?). Quote Link to comment Share on other sites More sharing options...
Chiblue Posted September 2, 2010 Share Posted September 2, 2010 LNK2019 means that CreateHost has been declared, but the linker cannot find where that function is defined. As I don't use the Leadwerks networking commands, I wouldn't know what you would need to include to fix it So what do you use? Quote If it's not Tactical realism then you are just playing.. Link to comment Share on other sites More sharing options...
Canardia Posted September 2, 2010 Share Posted September 2, 2010 You need to drag netwerks.cpp into your project. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.