Link to home
Start Free TrialLog in
Avatar of SME_Paddington
SME_PaddingtonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

C++ Networked BlackJack Card Game

Dear Experts,

I have been developing a C++ game over the last few days with your assistance.

I need your help in one final little instance, I am attempting to get the game to connect to another client as a server, but it fails to connect - very strange. I have been racking my brains over this all last night, and cannot find the answer.

I have included a Mediafire locker, with the p-a-ssw-o-rd protected content as this is proprietary code.

Please note these are RAR files, and the p-assw-ord is shown within the image attached. If you could please take a look at my application, and see if there is anything wrong with it, I would be extremely grateful.

If you can see any other errors, please discuss them - but please be careful about discussing individual code.

Code Share Folder: http://www.mediafire.com/?9q9dz4ib0xk25

Kind Regards,

User generated image
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SME_Paddington

ASKER

Hi Sara,

I have not checked yet WSAGetLastError().

Yes, from CSimpleClient_TCP:Connect... I received that exact error.

 I am able to have a client connect to the server console, but I am not able to initiate a remote connection to the other server.

BlackJack:

 Client -> Server    = Working Perfectly
 Server <- Client    = Attempting to connect failed. I normally receive the error: Bind() failed.

After having edited the code, it now times out. I appreciate you taking time to look at my code.

There is also one last file for the CSimpleClient_TCP which I was not able to initialise (that is included in the original built file). I will upload that to the media share, same p4ss-w0rd as before. It could be the source of the problem.

Kind Regards
for remote connection you need your firewall to allow that. did you use windows firewall or firewall from antivirus (or both???)  ?

the settings of your firewall should allow you to open output connections for some ports.

how do you address the remote server? by name or by ip? if ip address, is it ip4 or ip6?

if by name, are you able to ping at the commandline using that name? if not you should either add the name - ip relation to hosts file (on xp it is at system32\drivers\etc) or change the server name to ip address in your client.

unfortunately there are many reasons why a socket connection to a remote server could fail. can you call the WSAGetLastError() and check in winerror.h what the return value means?

Sara
I have been using port: 8015, and essentially this is not blocked by either firewall. (I have not tried turning off the firewall yet).

I was connecting to a remote computer on my network, which is connected locally via the use of Wireless. When not connected via via wireless it would not allow the connection, as it was blocked by 2 routers that exist on the network in between the 2 nodes.

Situation 1 (Wired Cable) :
MyComp ==> Router 1 (I.net Access) ==> Router 2 ==> Remote PC

RemotePC fails to connect to MyComp.

Situation 2 (Wireless):
MyComp ==> Router 1 (I.net Access) ~~~~> RemotePC

MyComp fails to connect to RemotePC

Remote Connection performed by IP. IPV4.

Okay Sara, will do as soon as I have written up the report for this coding I will check out the WSAGetLastError() message. Please bear with me, as I am submitting this tonight. As soon as the report is done, I will update you on the status of the errors.
You may be right, looking at it now, if remote connections to the local IP are blocked, then it could essentially stop communication from occurring whereas remote connections from the local IP are not blocked...

Situation 1 and Situation 2 have not been fully tested with all states please note.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Debugging with this function found the error.