• Content count

  • Joined

  • Last visited

Community Reputation

133 Neutral

About Novark

  • Rank
  1. Peer-to-Peer (UDP) Issue

    I figured it out!   It was my modem's settings.  I had to forward the port I was using on my modem.  It has it's own NAT which was enabled.  For anyone who might be curious, my modem model is:  SMCD3GN.  The username / password were posted on a little sticker attached to the modem.   I've been struggling with this problem on and off for ages, and it never occurred to me that it was my modem that needed to be configured properly, and not my router.   Works like a charm now! 
  2. Peer-to-Peer (UDP) Issue

      I was always kind of hoping that this wouldn't be the case.  I ran ipconfig and my public IP wasn't listed anywhere.  I get the typical 192.168.XX.XX.  This is all while bypassing my router and plugging directly into the modem.   If this is the case, and my ISP is providing NAT services, is there anything I can do?  Also, is there a way that I can verify that this is absolutely the case, and not something else?   Update:  Pretty sure the issue is with my modem.  It has it's own NAT that I need to work around.  I'm in the process of trying to find the default username / password that my ISP uses for this modem right now.  I'll keep this post updated.
  3. Peer-to-Peer (UDP) Issue

      I define my listener as follows:   Public listenerEndpoint As New IPEndPoint(System.Net.IPAddress.Any, 54329) Public rxClient As New UdpClient(listenerEndpoint) 'This client will listen on port 54329   I ran a netstat -a -p UDP command and found the following line:   Proto         Local Address       Foreign Address       State .              .                   .   .                 .                   . UDP             *:*   It would appear as though everything is normal.  I made an Inbound Rule in my firewall for my application and made sure that it's profiles are enabled for Domain, Public and Private connections.  I also made Inbound and Outbound rules for Port 54329 which is the port that I'm listening on.   I tested it with my friend once again, and got the exact same results - I still don't receive anything.  I can still receive messages locally if I send them to which tells me that the code for the listener is at least working as intended...   I looked in Wireshark (on my end) and it still says that the port is unreachable when I send messages to my public IP address on port 54329.
  4. Peer-to-Peer (UDP) Issue

      #1)  Could you elaborate on this point a bit?  I create a UDPClient reciever that listens on port XYZ.  I didn't specify a host address (although I could without any difficulty...perhaps I'll give this a shot - maybe it's defaulting to listen on or something)   Update #1:  I looked into this a bit more, and found the following documentation:   This constructor creates an underlying Socket and binds it to the port number from which you intend to communicate. Use this constructor if you are only interested in setting the local port number. The underlying service provider will assign the local IP address. If you pass 0 to the constructor, the underlying service provider will assign a port number. If this constructor is used, the UdpClient instance is set with an address family of IPv4 that cannot be changed or overwritten by a connect method call with an IPv6 target.   Maybe this is the problem!  I'll update this again with my findings after I test it.   Update #2:  I tested it again, specifying a listening host address set to my public IP, but still no luck.  I performed this test while directly connecting to my modem to avoid any problems that my router might introduce.  I also checked the traffic with Wireshark and noticed that the packets were being sent correctly, with the correct address and port, however, I was being informed by the ICMP that the destination was unreachable (port unreachable).   #2)  I'm on a home network right now, so there shouldn't be any problem with certain packets getting blocked   #3)  I have Wireshark, but I'm a bit inexperienced with it.  I'll look into it though.
  5. I'm trying to make a simple P2P chat application (in VB 2010 - just for practice) that uses UDP.  I've finished the application, and I can send messages locally by sending on   I've sent the executable to a buddy of mine to help me test it, but I'm unable to receive anything.  My initial thought was that this was a NAT issue, and that I would have to employ an introducer to punch through my NAT.  To keep things simple for now, I decided to just bypass my router entirely and connect directly to my modem in order to test this.   Still no dice.  Just to be clear, I gave my friend my IP (96.55.XX.XX ... not a local address) and the port that my client is listening on.   Even if my friend is behind a NAT, shouldn't I still be able to receive packets?  If I tried to reply to his messages, that could obviously be a problem if he's behind a NAT.  I'm strictly talking about a one-way communication here though.  Him sending messages to me.   I can't see it being a firewall issue either, since I've added a rule for my application in my firewall settings. Can anyone think of a reason as to why I wouldn't be able to receive his messages, despite the precautions I've taken?   Thanks in advance!
  6. [quote name='hplus0603' timestamp='1336603337' post='4938801'] I'm pretty sure it is related to your firewall, or perhaps the firewall of your ISP. Also, your Friend B probably has the same (or a similar) problem. Get yourself access to a UNIX shell somewhere outside of your local network. Then try to "telnet your-public-ip your-port" and see if it connects, or doesn't connect. If it doesn't connect, it's a firewall/port-forwarding problem. [/quote] I think I can rule out the possibility that my ISP is at fault, since I have never had problems with them before, and my "Friend A" also has the same ISP and I'm able to connect to him just fine. Please forgive my ignorance on the subject, but what exactly would be the difference between using a -telnet command versus getting my "Friend A" to try to connect to me? Is it simply to eliminate the possibility that there's something on my friend's side of things that could be wonky, or is there another benefit to using a UNIX shell to test?
  7. [quote name='VildNinja' timestamp='1336459467' post='4938310'] [quote name='Novark' timestamp='1336458911' post='4938307']My concern is that you are correct and that it's my ISP doing something silly and preventing me from being able to test things properly. I've never had an issue with them before though, and I've done other stuff locally (such as running an apache server on my local machine) that has never given me trouble when connecting to my public IP. [/quote] Have you ever tried hosting any non-HTTP based services on your computer? or services on other ports than port 80? Some proxies limit access to HTTP, but I never heard of any one doing it on incoming traffic only.. But sorry, that's kind of how far my network knowledge go [img][/img] Try hosting a random game. preferably one where your friends can connect directly to your IP, without entering a lobby (lobbies tend to do some nifty NAT tricks) [/quote] To my recollection, I've had other things working where my friends were able to successfully connect to me via my public IP address. Sometimes it won't work, and I'll have to join one of them, but that might be due to other factors since I'm usually connected via a router. In this one instance with my server/client architecture, however, it doesn't seem to work unless I join my friend. It's driving me nuts, because I've eliminated the possibility that it's something with my router / firewall, and I don't know else I can try at this point...
  8. [quote name='VildNinja' timestamp='1336458075' post='4938302'] Can you connect to your own public IP? When I do network I always first host the connection on my computer. Then first tries to connect to localhost, if that works i connect to my LAN IP, and finally connect to my public IP. But your problem most likely lies in A) not having forwarded all the ports, or B) being behind some external firewall/proxy from your ISP. [/quote] Nope. I wasn't able to connect to my public IP - which I found quite strange as well. works - as it clearly should. With regards to the ports, I've 'forwarded' all of the ones that I'm using, and I've even tried disabling my firewall entirely (not the best idea, but it was a good test at least). My concern is that you are correct and that it's my ISP doing something silly and preventing me from being able to test things properly. I've never had an issue with them before though, and I've done other stuff locally (such as running an apache server on my local machine) that has never given me trouble when connecting to my public IP.
  9. I'm trying to test my server/client architecture with a friend (Let's call him "Friend A"), and have already determined that the code is working correctly, since I am able to join my friend when he hosts. For whatever reason though, he can't connect to me when I host. I've tried a number of things, but nothing seems to work. I've tried bypassing my router entirely and connecting directly to the modem, but he still wasn't able to connect when I hosted. I've added the necessary ports to the inbound/outbound lists on my firewall as well (while still connecting directly to my modem), and I've even tried disabling any anti-virus software that might have been messing with things. I can't really think of anything else that could be wrong with my setup. Just for kicks, I also tried the same steps using UDP, but I got the same results. I could connect to him, but he couldn't connect to me. I got another friend to help test, as well. We'll call him "Friend B". I can't connect to "Friend B", nor can he connect to me. "Friend A" can't connect to "Friend B", however, "Friend B" can connect to "Friend A" (just as I can). So the only person who can apparently host, is my "Friend A", despite my efforts to open up my computer to incoming connections. I haven't asked my "Friend A" to do any sort of configuration on his end. He's connected to a router, and both myself and my "Friend B" are able to connect to him just fine. Has anyone else ever encountered a similar problem? Any ideas as to what might be causing this? Please let me know if I can clarify anything, or provide additional details.
  10. Quote:Novark, perhaps you missed my question earlier. Is this for an array or a linked-list? I'm using arrays in my implementation, but feel free to share your method using linked lists if you want!
  11. Thanks for all the replies everyone, I'll take a look at some of the suggested methods!
  12. Quote:Original post by LorenzoGatti Pivot choices can be good on average given a certain distribution of keys, but there is no way to improve the worst case significantly: for example, if you pick the median of 2n+1 arbitrarily chosen keys as a pivot a partition can have as few as n items. I'm not too concerned about improving the worst case - just looking for ways to either avoid it (randomizing the data usually does the trick), or thinking of other ways to choose the pivot. I'm sure there are probably some articles written on this. Quote:Are you sure you want to use Quicksort? Yep, I'm not implementing this for anything in particular...just messing around to try and find decent results for sorting a list of integers.
  13. I'm working with Quicksort, and am wondering: What are some methods that you use to choose the pivot to optimize performance? I'd like to set up two quicksort functions and try comparing their performances with different pivot choices. Any thoughts/ideas? :-)
  14. Quote:Original post by Uziel2101 Also to note along with what jyk has said; your array is going out of bounds and writing into memory it doesn't own. It may work now but at some point it will crash. when you declare an array of size "length" you allowed to access "array[0], array[1] .... all the way to array[length - 1]" anything beyond that the array doesn't own, and can / usually crash. As for filling an array with 0's I personally go with memset. Thanks for the tip - for my purpose, the array will never need to be expanded, so I won't need to worry about writing past the end of the array.
  15. Quote:Original post by the_edd std::vector<Ball> balls(len); Thanks, I'll take a look at this. Quote:Original post by jyk This'll all be pretty standard stuff, but here are a few tips. First, your code, cleaned up a bit and with some comments added: *** Source Snippet Removed *** As for your 'for' loop, the C++ standard library provides a convenient function that assigns a single value to every element in a specified range. In this case, you could replace your entire for loop with the following line of code:std::fill(array, array + length, 0);As for creating an array of objects of a class or struct type rather than of a built-in type, it depends on a number of things, but the simplest case would look like this:Ball* array = new Ball[length];In other words, the same as in your example above. Once you feel you have a good grasp of how dynamic memory management works in C++, it would be a good idea to look into some of the containers offered by the standard library, such as vector. (Once you've spent some time with these various container classes, the advantages of using them will most likely become self-evident.) Good stuff - Thanks!