Jump to content
  • Advertisement

aviosity

Member
  • Content Count

    155
  • Joined

  • Last visited

Community Reputation

194 Neutral

About aviosity

  • Rank
    Member
  1. Adam_42, Kylotan, Toolmaker, That's exactly what I was looking for, and what it looked like was going on. I really appreciate all the help everyone's given here...I'm gonna go start implementing a better timer [smile]. Thanks so much, Aviosity
  2. Hey iMalc, visage, I don't want to control the timeout on my connect call, I want to make sure I have accurate timing. The example I posted above using getchar() shows something really goofy going on with clock(), and not just in conjunction with connect(). This indicates to me that the issue is with clock() and not with connect() (I'm not sure whether or not that's a blessing [smile]). On my system, clock_t is defined (typedef'd) as an unsigned long. I should have no problem just passing it to printf with a %d format specifier, but have cast it to an unsigned long to make sure, which results in no compilation errors or warnings and is generating the same result. I appreciate everyone's help so far - this is driving me absolutely up a wall that I don't have an accurate timer (which is rather important for what I'm doing). Anybody else see something I might be goofing up? Thanks so much, Aviosity
  3. So I've discovered the problem isn't just related to connect(). When I write this particular piece of code: printf("Clock start: %d\n",clock()); getchar(); printf("Clock end: %d\n",clock()); The printfs show only about a quarter of a millisecond of elapsed time (about 250 ticks), where I've left the program sitting and holding for upwards of 30 seconds (roughly 30 million ticks). If I weren't already bald, I'd be in trouble [wink]. My understanding is that clock() does not stop counting ticks when the program blocks or is waiting for an interrupt, but am I flawed in this? And if I am, what should I be using instead of clock() for high-resolution timing? I'm running on OS X 10.5 using g++ 4.01 on a Core 2 Duo. CLOCKS_PER_SEC is defined at 1,000,000. I'm kind of grasping at straws here, so if anyone has any idea what's going on here, I'd appreciate it [smile]. Thanks, Aviosity
  4. Hey Adam, That makes sense, and I'm attempting to connect to a server (aviosity.org) on a port I know isn't open or have a listener on (5190). I want to hit the timeout, because I'm using it to test my timer. It literally looks, in the output, like the clock has only executed 100 ticks (roughly) over the course of a 60-second timeout. The entire program hangs for 60 seconds while connect() is attempting to establish a connection, but the clock ticks seem to say its only been hanging for fractions of a millisecond. Any more ideas? Thanks so much, Aviosity
  5. My guess is that svchost is connecting to Windows Update to check if there is an update to the driver or system with the new driver installed. However, maybe you want to try packet sniffing to figure it out? If you can tell that svchost is sending and receiving data, it shouldn't be much more difficult to dump the packets being sent and received. Hope that helps, Aviosity
  6. What? My word isn't good enough? [wink] You're probably absolutely right. Here's conn.start(): NETERR NetworkConnection::start(char* host, unsigned int portNum) { int result = 0; DEBUG("Starting TCP network connection to host %s on port %d...\n",host,portNum); //Attempt to create socket. sockFD = socket(PF_INET,SOCK_STREAM,0); if(sockFD == -1) { DEBUG("Error creating socket.\n%s\n\n",strerror(errno)); return NETERR_OPEN; } else { DEBUG("Socket opened (file descriptor %d).\n",sockFD); } //Attempt to look up host data. hostData = gethostbyname(host); if(hostData == NULL) { DEBUG("Error retrieving host data for %s.\n%s\n\n",host,strerror(errno)); return NETERR_HOSTLOOKUP; } else { DEBUG("Host data retrieved:\n Original hostname: %s\n Resolved hostname: %s\n Host IP: %s\n",host,hostData->h_name,inet_ntoa(*(struct in_addr*)hostData->h_addr)); } //Setup host sockaddr structure. hostAddr.sin_family = AF_INET; hostAddr.sin_port = htons(portNum); hostAddr.sin_addr = (*(struct in_addr*)hostData->h_addr); //Attempt to connect to server on given port. result = connect(sockFD,(struct sockaddr*)&hostAddr,sizeof(hostAddr)); if(result == -1) { DEBUG("Error establishing connection to %s on port %d.\n%s\n\n",host,portNum,strerror(errno)); return NETERR_CONNECT; } else { DEBUG("Socket %d connected to %s on port %d.\n",sockFD,hostData->h_name,portNum); } //Return and declare as open. DEBUG("Socket %d ready to send/recv.\n"); open = 1; return NETERR_OK; } Note that any variable (such as hostData, hostAddr, and open) are member variables of the NetworkConnection class. The last message I get before the long 60-second timeout wait is the hostData output, so I think it's fair to assume the actual pausing is taking place at connect(). As a side note, I placed DEBUG statements (and also, just to make sure it wasn't something bizarre with my DEBUG statements, I checked with printf) right around the connect() call and saw the same behavior. To me, it looks like connect() is almost pausing the clock()...which can't be. Let me know if there's anything you need me to clear up [smile]. Thanks so much, Aviosity
  7. aviosity

    Some of your top Songs

    Splashdown - Iron Spy, Pandora Zero 7 - Destiny, Distractions Ted Leo and the Pharmacists - La Costa Brava Pretty much the entire Once soundtrack Van Halen - Panama, Running With the Devil, Ain't Talkin' 'Bout Love John Mayer - Slow Dancing in a Burning Room and his Hendrix cover of Bold as Love That's for right now...I change favorite music pretty rapidly.
  8. aviosity

    CL, Scheme, OCaml, or other?

    Personally, I prefer Scheme over Common Lisp mainly because of the macro system. I really do love define-syntax [grin], although my institution is big into Scheme so I guess I've been biased from the start. Some Scheme resources if you decide to go that route: Petite Chez Scheme - the compiler I use for school Ikarus - another Scheme compiler, and it's FAST [inlove] The Scheme Programming Language, 3rd Ed. - an awesome book on Scheme. Those are what I've used here at uni. Hope that helps, Aviosity
  9. aviosity

    Really help on this

    Hey HmW87, You probably should ask someone who goes to NYP, or someone that's been there before...I Googled NYP_FRAMEWORK and it's something Nanyang Polytechnic uses in some of their courses from what I gathered. If you're having trouble getting this project to link, chances are other folks who have taken these classes have as well...without knowing how your libraries are structured and which libraries this framework is using, the best I can tell you to do is look up the LNK errors on MSDN (trust me, when I was doing DLL work it made me want to pull my hair out sometimes too [wink]). Searching gamedev for NYP_FRAMEWORK turned up a user, koalacui, who in 2005 it looks like was using the same framework (link to post here). Maybe you want to try messaging him and see if he had similar problems? He hasn't been active for a little while, though. I know it's not a solution, but maybe it'll get you closer to one [smile]. Hope that helps, Aviosity
  10. Hey all, First off, I've posted here (instead of under Multiplayer and Network Programming) because this might be a more general problem than just with connect()...however, if a mod feels differently, please move it [smile]. I've written a custom timer class that uses clock() to get the ticks elapsed since program start. I've also written a NetworkConnection class with a start() method, that uses connect() to establish a connection with a remote server. My networking code works properly to the best of my knowledge. I started noticing weird timing with clock() when I made connect attempt to establish a connection on a port it would timeout on (my current timeout is set to 60 seconds), so I bailed on my custom timer class and just looked at clock() itself. I essentially have code that looks like this: NetworkConnection conn; printf("MS start:%f\n",((float)clock()/CLOCKS_PER_SEC)*1000); conn.start(); printf("MS finish: %f\n",((float)clock()/CLOCKS_PER_SEC)*1000); The milliseconds returned should be in the vicinity of 60000, since my timeout is 60 seconds. Instead, I have a MS start of roughly 0.0 ms, and a MS finish of roughly 0.5 ms. This leads me to believe one of two things: 1. connect() is non-blocking for I/O, causing these printfs to just execute while the program is waiting for connect to return its inevitable -1. or 2. the program is executing the clock() calls in the printfs as soon as it can, and isn't related to conn.start() at all; the output is put to stdout after conn.start() finishes its execution, but the clock() call is done prior to conn.start()'s execution. Or is it just really late and I'm being an absolute dunce about this? Thanks, Aviosity
  11. aviosity

    AIM OSCAR question - any ideas?

    Ra, I can't thank you enough for getting me over that hurdle!! I'm now getting an actual srv_cookie response on channel 4. Interesting, I didn't know the server sent an immediate version response, I thought you first had to send the authorization packet. I am getting a proper response now (one of my TLVs has a type of 0x0006, the BOS authentication cookie), so I'll keep hacking on this and post again if I hit another hiccup. Thanks, Aviosity
  12. aviosity

    AIM OSCAR question - any ideas?

    Thanks hplus! Hm, you're absolutely right about the channel being incorrect; for some reason I read that as it would be on channel 4 ordinarily but on 1 for auth_failed. Now this is really confusing; the response packet is not only of the wrong format, it's on a completely different channel. I'm going to keep hacking on this, see if I can make some sense of it; I assume the 0x00000001 is a status code as you said, I just don't know what to make of it. Guess I have only myself to blame for choosing a project like this [lol]. If anybody else has anything, I'm happy to hear it [smile]. I'll update everyone if I get anything good going. Thanks, Aviosity
  13. aviosity

    ******* Merry XMas !!! *******

    Merry Christmas and Happy Holidays, everyone! [smile]
  14. aviosity

    AIM OSCAR question - any ideas?

    Thanks again, Marineio. Yeah, the error code would have to be contained in the error code TLV, which is contained in the 2nd TLV after the screenname TLV...if the server is actually responding according to spec, it should return the screenname TLV as the first TLV in the FLAP packet (in my case, the error code TLV would be 13 bytes after the start of the FLAP data, as my screenname is 9 bytes long). However, I'm just getting 0x00000001. I've done some searching (actually, a lot of searching) and am getting no info other than references to the auth_failed packet. The format of the auth_failed packet is at the bottom of the page I linked to in my last reply. I know I got the whole packet because multiple recvs yield 10 bytes on the first recv and then I get a connection reset by peer on subsequent recvs on the same socket. Splitting the packet up by restricting my recv length to 5 and using multiple recvs still only yields 10 bytes. I've also attempting resending my cli_ident packet, and got no response whatsoever from the server (save for a connection reset by peer), even after copying the FLAP sequence number and incrementing it. Even the semi-commented code in libpurple (the library used by GAIM, Pidgin, and Adium) expects a response packet in any case that contains a screenname. Am I one of the only people in the world who has tried working on this? :-P I thought there would be a decent number of people doing this, especially with the welcome introduction of many open-source AIM clients over the last few years, but most of the info I've found relates to libpurple (which abstracts away the low-level of networking, something I'm not interested in) or is years and years old. Any more ideas? I appreciate any help! Thanks, Aviosity edit: I don't know if this is an added incentive to take a hack at this (:-P), but I would be more than happy to write up a tutorial on this if I get it working (and of course will cite the help I get from anyone here). I think this would be a really neat networking app for people to hone their skills on and I'm very willing to share what I learn if I get it working!
  15. aviosity

    AIM OSCAR question - any ideas?

    Hey Marinelo, Thanks for the response; yeah, that's what I gathered. Sorry, I guess I wasn't clear - the confusion is in the fact that the FLAP data is just a long with value 1. If you look at the auth_failed packet response that is supposed to come back from the OSCAR server, the FLAP data contains 3 TLVs, the first of which is the screenname. Instead of a FLAP packet with 3 TLVs as its data, I'm just getting that long. I'm thinking maybe AOL has recently changed the auth_failure packet? Anybody have any experience with this? Thanks, Aviosity edit: if it helps, here's the link to the auth_failed packet and what it's supposed to look like: auth_failed
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!