|
|||||||
This is a discussion on "Mud Server" in the Top Mud Sites MUD Coding forum : 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 ... |
|
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our MUD community today! If you have any problems with the registration process or your account login, please contact us. If you are a registered member of the old TMS forums, please click here
|
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 | |
|
New Member
Join Date: Mar 2003
Posts: 29
![]() |
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:
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 |
|
|
|
|
|
|
#2 | |||
|
Senior Member
|
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:
Quote:
|
|||
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2003
Posts: 29
![]() |
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. |
|
|
|
|
|
#4 | |
|
Member
Join Date: Apr 2002
Location: Seattle
Posts: 32
![]() |
Quote:
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. |
|
|
|
|
![]() |
| 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 |
|
|