Jump to content


Member Since 06 May 2008
Offline Last Active Apr 05 2013 05:01 PM

Topics I've Started

Peer-to-Peer (UDP) Issue

21 March 2013 - 10:11 PM

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!

Peer-to-peer connection issues (TCP/IP)

07 May 2012 - 10:44 PM

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.

Quicksort Pivot Selection

03 March 2010 - 06:38 PM

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? :-)

Filling a dynamic array with objects (C++)

06 February 2010 - 03:14 PM

I'm trying to make an array of size 'len' and fill it with objects, let's say for example 'Ball'.

Edit: Sorry, should have mentioned - C++.

Here's an example (filling an array with ints):

void Simulate(int len) {
     int i;
     int *arr = NULL;
     arr = new int[len];

     for (i=1; i<=len; i++) {
          //Fill the array with zeros
          arr[i] = 0;

void main() {

How would I accomplish this (inserting objects instead of ints)?

C++, Passing objects to implementation cpp file

20 January 2010 - 07:54 AM

I'm doing something fairly simple - checking the intersection of two circles. In main():
Circle c1 = Circle(0,0,5) //x, y, radius
Circle c2 = Circle(4,0,2)

if (c1.intersects(c2)) {
   cout << "c1 intersects c2";
In the circle implementation file:
Circle::Circle() {
	cX = 0;
	cY = 0;
	cR = 10;

void Circle::setX(int x) {
	cX = x;

void Circle::setY(int y) {
	cY = y;

int Circle::getX() const {
	return cX;

int Circle::getY() const {
	return cY;

Circle::intersects(Circle c) {
   //I need to have access to both c1's X attribute, AND c2's X attribute in order to calculate whether or not they intersect.

   //As a simpler example, let's say that I wanted to compare c1.getX() and c2.getX() and see which one was larger.  How would I go about this?
I obviously didn't include the whole implementation file, but this should hopefully be enough to explain my question. I would appreciate any help with this! If I didn't give enough information, feel free to ask. Thanks!