• Content count

  • Joined

  • Last visited

Community Reputation

120 Neutral

About rnw159

  • Rank
  1. Thanks for the answers, I somehow avoided learning this stuff in school. You've helped me out a lot with this work.
  2. Well I have maybe 20 external libraries in this project. Is there any easy way to get already compiled libraries for other platforms? It takes ages to compile these libraries, and the ones that compile fast are always the hardest to use a cross compiler with.
  3. Thanks for the info. Back to the ARM compile for a second: Say the program uses Boost, will I need to recompile Boost under ARM (or a toolchain)? Or will I be able to compile the whole project using the version of boost already compiled and used in the project?      Thank you so much for the thorough response.
  4. So I'm trying to cross compile a large project on Ubuntu x86 for ARM unix and windows x86.    Questions:   For the ARM cross compile I have to compile all of the libraries it uses seperatly before using a toolchain to compile the whole project right? If not whats the proper procedure?   For the windows compile do I need to recompile all the libraries? Or will it be fine because its using the same cpu architecture?   What will a change in os mean for the work I have to do?   What will a change in cpu architecture mean?   What will a change in both mean?   Thank you for your help.
  5. This was the first encryption software I ever made. I make games more often. I made it for a friend who wanted it real fast and couldn't tell any better. One of the reasons I don't post here very often is that when I do, I always get some guy who knows the area 100x better than I do and shoots down my work. Also, I just realized that the code is in the rar file. I did not mean to put it there.
  6. Just realized that it may look strange to ask people to run an exe file just like that. So can one brave person run it, then post proof that it is safe?
  7. A friend asked me for a file encrypter a while ago, so I wrote one in console. He just told me that it has been really useful for him and I should consider giving it to other people. It just asked you to drag and drop the file on the screen, and it encrypts it with a key you can use to decrypt it from the same program. Anyway, it is rar'd with this post if you want it. [attachment=6713:Encrypt.rar]
  8. [quote name='npri' timestamp='1304584639' post='4806798'] [quote name='rnw159' timestamp='1304566321' post='4806732'] I'm using non blocking because I'm sending game data. If select is what I need then I will look into it. Thanks! *edit* I have a new problem. The program works great in terms of successfully sending information. However, there is about a 10 second lag when I'm trying to send realtime information. This is being sent over local The server takes a long time to send the data after it has been received. and the client takes a long time to send the data to the server. [/quote] One cause may be if you're sending many small messages over TCP, they may not actually be transmitted until the outgoing stream buffer is of a certain size. [url="http://msdn.microsoft.com/en-us/library/ms740476%28v=vs.85%29.aspx"]setsocketopt[/url] - Check out TCP_NODELAY [/quote] Thanks this helped a lot! The problem I have now is that if I continually send data the lag gets greater and greater until I stop sending data for a few seconds. CAn you offer some help on this? *edit* Also it gets twice as laggy for every client I add. Any suggestions?
  9. I'm using non blocking because I'm sending game data. If select is what I need then I will look into it. Thanks! *edit* I have a new problem. The program works great in terms of successfully sending information. However, there is about a 10 second lag when I'm trying to send realtime information. This is being sent over local The server takes a long time to send the data after it has been received. and the client takes a long time to send the data to the server.
  10. [quote name='Striken' timestamp='1304513331' post='4806385'] I haven't played around with raw win32 sockets for a while as I'm quite fond of the abstraction that boost::asio provides. I do think however it is very important to understand the key underlying concepts as you are doing by working at the lower level so I'll give you some examples. This is from the top of my head without much thinking about it so usual disclaimers apply.... This is an example of sending data... receiving is similar in principle. This probably isn't your problem because sending just 8 bytes is likely to succeed in one call but this is necessary nontheless. [code] // Encapsulating sending a buffer of generic data. Accepts the array of bytes to send // and the number of bytes to send. (True success, all sent, false failure). This is blocking. bool sendData(char *i_buf, int i_bufLen) { int offset = 0; int rc; while (offset < i_bufLen) { rc = send(socket, i_buf+offset, i_bufLen-offset); if (rc == SOCKET_ERROR) return false; offset += rc; } return true; } [/code] Your main concern is converting your data types into a common format supported at your client and server ends. Here is an example of receiving and translating data: [code] char recvData[256]; uint32_t playerX = 0; uint32_t playerY = 0; if (receiveData(recvData, 256)) { // Similar to sendData // We've succesfully read 256 bytes of data, we know that the stream starts with 2 4-byte integers. Read them: // Read each byte into the integer representing the player position (similar to the way I'd do it) playerX = recvData[0] << 24; playerX |= revData[1] << 16; playerX |= revData[2] << 8; playerX |= revData[3]; playerY = recvData[4] << 24; playerY |= revData[5] << 16; playerY |= revData[6] << 8; playerY |= revData[7]; // Or use the helper function for this something like this: // playerX = ntohl(*(uint32_t*)recvData); } [/code] There's a whole lot more I'd recommend doing - think about implementing your own message buffer class that serializes / deserializes different data types into an appropriately encoded byte array.I hope this gives you an idea of what you need to do. [/quote] Wow thanks, there are no tutorials for this anywhere. Is this method 100% reliable. I don't understand the part about reading each byte by the integer representing it. Can someone elaborate?
  11. [quote name='Striken' timestamp='1304511028' post='4806372'] Hmm looking at your code there are a few fundemental things wrong with your implementation.. Assuming this is all win32 sockets: Firstly the call to "recv" does not guarantee to read the entire packet as you're expecting it to. You need to encapsulate it within a loop that reads from the incoming stream until the expected amount of bytes are read as indicated by the return value of the function call. Same applies to the call to send - it doesn't guarantee that the whole packet is sent within 1 call. Next simply reading and writing to the packet structure as a buffer is a very bad way of doing things for a number of reasons - but foremost it's highly likely byte ordering on the recipient end will probably not be as you expect it to. If you're doing things with floating point values then you're really asking for trouble (look up nthol and htonl and others). Attempt to write a manual serialization for each data type within the packet. Also be aware that byte packing may be different the client/server so the sizeof(packet) may return different values. There are probably a few more issues but I hope that sets you in the right direction. [/quote] Thanks thats great! Do you know any examples of this implementation? CAn I see some source code?
  12. [code] void send(){ PlayerPosPacket packet; packet.x = x; packet.y = y; packet.player = id; //char szBuffer[1024]; //SendData((char const *)&packet); send(mySocket,(char const*)&packet,sizeof(packet),0); //send(mySocket, buffer, strlen( buffer ), 0 ); ZeroMemory(&packet, sizeof(packet)); } void recv(){ PlayerPosPacket recvPacket; int r = recv( mySocket, (char *)&recvPacket, sizeof(recvPacket ), 0); textprintf_ex(screen,font,0,0, makecol(0,255,0), -1, "x %d", recvPacket.x); if(r > 0){ x2 = recvPacket.x; y2 = recvPacket.y; textprintf_ex(screen,font,0,0, makecol(0,255,0), -1, "x %d", recvPacket.x); //ZeroMemory(&recvPacket, sizeof(recvPacket)); //allegro_message("here"); }else{} } [/code] The above code attempts to send the struct to another multi-client server I wrote. The server takes the data from one person and sends it to every other person except the one who send it in the first place. The problem is that I never receive the data I need to receive. I always receive either 0, or some other random number like 675390. Is there something wrong with my char* to struct. Please help me find the problem and fix it. It may be that I am missing some fundamental c++ skill that I somehow overlooked. (Although it is unlikely) *edit* What would be nice is an example of a client and a server sending a struct and then viewing the information. forgot to mention, this is nonblocking.
  13. Alright I tried all of your suggestions and non of them had any effect. The program always works fine until winsock2 is linked. Then, even when it is taken out, the problem persists. *edit* Alright, I just found out that my compiler is compiling it with: g++.exe -D__DEBUG__ maindawdaw.o -o "Project2.exe" -L"C:/Dev-Cpp/lib" -L"C:/SDL-1.2.14/lib" ../../lib/libws2_32.a -g3 -mwindows The obvious problem here is the -mwindows. How can I get it to compile without -mwindows? *edit* Manually changing the settings to console don't work. On compile the settings revert back to -mwindows.
  14. [quote name='hplus0603' timestamp='1304377727' post='4805683'] [quote name='rnw159' timestamp='1304349239' post='4805478'] [code]#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { cout << "hi \n"; system("PAUSE"); return EXIT_SUCCESS; } [/code] The problem is that this won't show the words "hi". They used to show the words, but then I compiled the program with winsock2. Even though winsock2 is no longer there. The problem still persists. [/quote] It's probably the case that your cout stream is not being flushed. Try printing to cerr instead, and try using std::endl instead of embedding a "\n" character -- Windows end line may not be \n alone. Another option is that you're building as a "win32 application" rather than a "console application" -- check your linker settings. Finally, console applications have to be started from the console/command line, rather than from within the debugger or the Explorer. Else they won't have the proper interactive TTY setup. (This is an oversimplification -- but for now, do it that way or you'll go crazy!) This has nothing to do with networking, btw. [/quote] Thanks, I will try that. I know the only correlation between this and networking in winsock2, but I thought this might be a problem that you had experienced before because people answering on this forum have probably used that library for a while.
  15. [quote name='Evil Steve' timestamp='1304350674' post='4805495'] And what compiler are you using? [/quote] First I was using vc++. The program I showed earlier was made using dev to see if changing compilers would fix the problem.