Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 12-29-2004, 04:57 PM   #1
Khadgar
New Member
 
Join Date: Mar 2003
Posts: 29
Khadgar is on a distinguished road
Due to college, I had to take a little time off coding my mud server.  However, I'm suppose to make a simple server for my honors project so I'm limited on the amount of time I have.  It's something I've always wanted to do so I'm happy doing such an ambitious project.  I just have a few questions that I need some help with:

1)  For MicroApplications, I had to design a Microsoft Access database for my game.  I only have problems reading boolean values. For example, assume that the database and recordset have already been open. I have to do something like the following:

[code] string boolVal;
CString sqlString;
CDBVariant variant;
LPCTSTR strConversion;

//retrieve indoors flag from the record
roomRecord->GetFieldValue("Indoors", variant);
boolVal = strConversion = *variant.m_pstring;
flags.indoors = (boolVal == "TRUE") ? true ; false;[/quote]

I think I should be able to do something like the following:

[code] roomRecord->GetFieldValue("Indoors", variant);
flags.indoors = variant.m_boolVal;[/quote]

However, the compiler gives me a warning that I am forcing the value to true or false from an int.  The boolean value always evaluates true even when it is suppose to be false.  In the database, the indoors field's data type is set to yes/no with format true or false, which im setting with a combo box. Any help with that will be greatly appreciated.

2)  For the networking part, I have to be able to login players, obtain IP addresses, host names, etc.  I seem to be having a problem with the host names.  For example, my IP address was 4.249.192.96 at the time this post was submitted.  I obtain DFBLP021 as the host name when I telnet to 4.249.192.96 on the port I setup using the following code:

[code] void Server;;AcceptConnections()
{
               if (FD_ISSET(m_socket, &readfds))
               {
                               sockaddr_in *sockInfo = new sockaddr_in;
                               int sockSize = sizeof(*sockInfo);
                               SOCKET sock = accept(m_socket, (sockaddr*)sockInfo, &sockSize);

                               if (sock != INVALID_SOCKET)
                               {
                                               cout << "New Client Connected; " << inet_ntoa(sockInfo->sin_addr) << endl;
                                               pList.push_back(new Client(sock, sockInfo));
                                               hostent *host = gethostbyaddr((char*)&sockInfo->sin_addr, sizeof(sockInfo->sin_addr), AF_INET);
                                               cout << host->h_name << endl;
                               }
                               else
                               {
                                               delete sockInfo;
                                               cerr << "Socket Error; " << WSAGetLastError() << endl << endl;
                               }               //end inner if statement
               }              //end outer if statement
}              //end member function Server;;AcceptConnections()[/quote]

Using a conversion utility on the Internet, I obtained the following information:
Quote:
Originally Posted by
dialup-4.249.192.96.Dial1.Washington2.Level3.net was returned from IP Address 4.249.192.96 in United States
ca1462-ch01-bl04.ma-cambridg0.sa.earthlink.net is your host/proxy name (IP Address 207.69.137.203)
Why is there a discrepancy with the host name? I'm sure there is a simple explanation for which i'm not aware.  Using ipconfig /all on the command prompt, DFBLP021 appears to be the correct hostname. If this were banned, would it ban everybody connecting to my service provider?

3) Is there a way to determine the MAC address of a client? If so, how would you go by doing it?

Thanks in advance to all those who respond as it is always greatly appreciated.  Now.. back to the coding 
Khadgar is offline   Reply With Quote
Old 12-30-2004, 08:00 AM   #2
Yui Unifex
Senior Member
 
Join Date: Apr 2002
Location: Florida
Posts: 323
Yui Unifex is on a distinguished road
Send a message via ICQ to Yui Unifex Send a message via AIM to Yui Unifex
Question

Quote:
Originally Posted by
[code] roomRecord->GetFieldValue("Indoors", variant);
flags.indoors = variant.m_boolVal;
However, the compiler gives me a warning that I am forcing the value to true or false from an int.[/quote]
Microsoft had this particular kick for representing boolean values as 0 and -1, and they commonly stored booleans in ints. I think changing your code to: flags.indoors = variant.m_boolVal ? true : false; should do the trick if the value contains what I think it does. Besides, have you tried printing the value to see what you get, or looking at the documentation to see what type it is?

Quote:
Originally Posted by
I obtain DFBLP021 as the host name when I telnet to 4.249.192.96 ... snip ...
dialup-4.249.192.96.Dial1.Washington2.Level3.net was returned from IP Address 4.249.192.96 in United States
The former is a NETBIOS machine name, the latter is your fully qualified hostname. The former is used on your LAN only, while the rest of the internet talks to you using the latter.

Quote:
Originally Posted by
3) Is there a way to determine the MAC address of a client? If so, how would you go by doing it?
Yes, but you don't want to do it. At the application level, particularly for a game, it is wholly unnecessary. We have these things called IP addresses that we use to address machines and networks. MAC addresses are not magic values that can't be changed -- if you're thinking of using them as a security measure, forget it.
Yui Unifex is offline   Reply With Quote
Old 12-30-2004, 05:18 PM   #3
Khadgar
New Member
 
Join Date: Mar 2003
Posts: 29
Khadgar is on a distinguished road
1)  I found some documentation about my first question after I made my first post.  It appears to be a compiler bug: Solution to Question #1

2) After I had some friends connect to my server, I seen that the hostname was printing out correctly.  Thus, I was able to implement host banning.  Thanks for clarification Yui Unifex about why mine was different.  

3) I was planning to use MAC address banning as a security measure.  I was aware of the ability to change a MAC address.  However, in my opinion, people know less about that than changing their IP address.  Host banning appears to work really well, but it may prevent non-troublemakers from logging onto the server. Nevertheless, I would just like to keep my options open when it comes to security, for I would like to take whatever measures best benefits my future mudding community.  Thus, if anybody has any information regarding the third issue, please feel free to share it.
Khadgar is offline   Reply With Quote
Old 12-31-2004, 01:52 AM   #4
Teelf
Member
 
Join Date: Apr 2002
Location: Seattle
Posts: 32
Teelf is on a distinguished road
Quote:
Originally Posted by (Khadgar @ Dec. 30 2004,14:18)
3) I was planning to use MAC address banning as a security measure.  I was aware of the ability to change a MAC address.  However, in my opinion, people know less about that than changing their IP address.  Host banning appears to work really well, but it may prevent non-troublemakers from logging onto the server. Nevertheless, I would just like to keep my options open when it comes to security, for I would like to take whatever measures best benefits my future mudding community.  Thus, if anybody has any information regarding the third issue, please feel free to share it.
I've looked into it only briefly in the past, but it seemed to be a non-trivial task.  Someone else may have better info for you.  

You have to send an ARP packet to request the MAC address of the source machine.  That may not be terribly difficult I'm not sure, but the ARP reply packet is not normally passed up to the application layer.  So I imagine you have to have some sort of low-level packet capture program running that is looking for the ARP reply.    

You'd be dealing with a lot of low-level raw socket type stuff.  libpcap may help you in this.
Teelf is offline   Reply With Quote
Reply


Thread Tools


Mud Server - Similar Threads
Thread Thread Starter Forum Replies Last Post
TMS Server Move imported_Synozeer TMS Announcements and Feedback 8 10-10-2006 09:59 AM
Mud Server Project MUD Announcements 0 03-21-2004 07:33 PM
Server Issues Astin MUD Announcements 1 10-17-2002 11:56 PM
dotNET server Zoulz Advertising for Staff 7 08-26-2002 03:45 PM
What is the best server for creating a mud? kaylus1 MUD Coding 19 06-11-2002 07:07 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 01:10 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014