View previous topic :: View next topic |
Author |
Message |
JetBird
Joined: 15 Aug 2007 Posts: 12
|
Posted: Sat Feb 09, 2008 5:44 pm Post subject: Descent, sockets error |
|
|
There is a strange error I get everytime when trying to run my program through the Descent IDE. The program creates the socket & attempts to set up the server (or client - there are the same problems), I used for that SDL_net (and also tried with tango.net.Socket), after the compilation the program works fine if I run it through the system console (cmd.exe), the server is working & the client can connect.
But if I run it through the Descent as the "D Application" I always get an error (on client & on server): can't create socket.
Maybe any special environment needed? |
|
Back to top |
|
|
asterite
Joined: 01 Jun 2006 Posts: 235 Location: Buenos Aires, Argentina
|
|
Back to top |
|
|
asterite
Joined: 01 Jun 2006 Posts: 235 Location: Buenos Aires, Argentina
|
Posted: Sun Feb 10, 2008 1:03 pm Post subject: |
|
|
Ouch, sorry. Wrong thread. I'll see what's going on. Can you share some source code for this? |
|
Back to top |
|
|
JetBird
Joined: 15 Aug 2007 Posts: 12
|
Posted: Mon Feb 11, 2008 5:39 am Post subject: |
|
|
sure, here is the server:
http://trac2.assembla.com/neiderra2/browser/server.d
in method "SpacesHighServer.setupNet()"
Code: |
void setupNet() {
// initialize SDL_net
assertM(this, "setupNet", SDLNet_Init() != -1, getSDLNetError());
assertM(this, "setupNet", SDLNet_ResolveHost(&ip, toStringz(host), port) != -1, getSDLNetError());
server = SDLNet_TCP_Open(&ip);
assertM(this, "setupNet", server !is null, getSDLNetError());
// create socket set
socketSet = SDLNet_AllocSocketSet(50);
assertM(this, "setupNet", socketSet !is null, getSDLNetError());
// adding server to set
assertM(this, "setupNet", SDLNet_TCP_AddSocket(socketSet, server) != -1, getSDLNetError());
}
|
SDLNet_TCP_Open produces an error: "Couldn't create socket"
in client, the same problem:
http://trac2.assembla.com/neiderra2/browser/client.d
in method Client.setup() function SDLNet_TCP_Open invoked with the same result. |
|
Back to top |
|
|
fraserofthenight
Joined: 08 Apr 2007 Posts: 33 Location: Seattle, WA
|
Posted: Mon Feb 11, 2008 4:26 pm Post subject: |
|
|
I actually recently ran into this error in Descent while I was working on the unittest component. It took me about 3 hours to track down. The problem is that the launching code passes an empty environment rather than a null environment to Java's java.lang.Runtime.exec() method, causing an empty environment to be created rather than the default system environment. This causes the Winsock DLL to refuse to load, since that must rely on some environment variables.
This is partially fixed in trunk (it's only fixed if your "environment" tab in run is empty; I need to figure out how to get the default environment), but in 0.5 I think the bug might still be around. This bug also exists on CDT, I'd assume, since the codebase is copied from there.
So, your solutions:
- Grab trunk & run that (actually 0.5.1 might work; tyry taht since the changeset where I fixed it is 1048 which was 2/5, so mayvbe it was folded into the release)
- Manually add your default environment to the environment tab on the run page (tedious)
- Run it outside Descent (but then no debug integration) |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|