Page 3 of 4

Re: Social Network

Posted: Mon Jun 18, 2012 8:29 pm
by tappatekie
dandymcgee wrote:
tappatekie wrote:
bbguimaraes wrote:Not at all, I knew the purpose was to "beta test" it. Everything I tried seemed to work (which was logging in, seeing the "no friends" message and creating a "hello world" post).
Okay, think it's a good idea to open up a "dreamland.dasocial.net" (like phpBB's Area51 thing...) to have all the features i'm working on to be tested before it goes "live"?.
Hmm, no idea how I'm going to intergrate it with the live server since it's all on 1 IP :L maybe a port number as well/instead of like dasocial.net:81
You don't need more than one IP to have subdomains. If you're using apache, you may want to look into Virtual Hosts. Also, you said you wanted to move to SQL. Out of curiosity what are you using now?
Homebrew database server (its not really a "server" since it's built right into the site code and web server code). (Would be best with SQL to be honest...) just need to turn the current database classes, into SQL wrapper classes and i'm good to go with supporting it :D

Erm, I have subdomains set in place now, but I need to make a subdomain seem it's port 80 port its port 90, or, a subdomain point to a different internal server. (May need the main web server to re-route traffic maybe?)
Web server is also custom, the sub-domains is done by just scanning the "Host" header by the http request and adding a CNAME "*.dasocial.net" on the DNS. (hense the [username].dasocial.net thing)

I'm also not actually using php (even though the extension is .php (I think it looks good... but I will soon remove the extension)) to just "/profile" or "/settings" etc...

Re: Social Network

Posted: Mon Jun 18, 2012 9:45 pm
by dandymcgee
tappatekie wrote:Erm, I have subdomains set in place now, but I need to make a subdomain seem it's port 80 port its port 90, or, a subdomain point to a different internal server. (May need the main web server to re-route traffic maybe?)
That would require setting up port-forwarding on your router.

Re: Social Network

Posted: Tue Jun 19, 2012 5:33 am
by tappatekie
dandymcgee wrote:
tappatekie wrote:Erm, I have subdomains set in place now, but I need to make a subdomain seem it's port 80 port its port 90, or, a subdomain point to a different internal server. (May need the main web server to re-route traffic maybe?)
That would require setting up port-forwarding on your router.
Port 80 is already port forwarded on the router, I know I need to portforward to get port 81 or something, the server is not hosted by a company online but a server that I have at my house.

Re: Social Network

Posted: Tue Jun 19, 2012 1:35 pm
by tappatekie
I've decided i'm going to cheat a bit, the main server will host "dreamland.dasocial.net" but will produce an iframe which links to dasocial.net:51 (it's 51 for area51 :D)

Re: Social Network

Posted: Tue Jun 19, 2012 6:18 pm
by dandymcgee
tappatekie wrote:I've decided i'm going to cheat a bit, the main server will host "dreamland.dasocial.net" but will produce an iframe which links to dasocial.net:51 (it's 51 for area51 :D)
No no no no.. please for the love of god do not use iframes. Port forwarding (for our purposes) is a simple lookup table in your router config. It maps an external IP and port to an internal IP and port.

Right now, it probably looks something like this:

Code: Select all

Ex Port	Int Port	Protocol	Destination IP
80		  80			TCP		  192.168.1.100
where 192.168.1.100 is the IP of your web server.

If you wanted port 8080 to point to a different server, rather than port 8080 of the web server, you would change it like so:

Code: Select all

Ex Port		Int Port	Protocol	Destination IP
80			  80			TCP        192.168.1.100
8080		   80			TCP        192.168.1.101
where 192.168.1.101 is the IP of the alternate server.

This would allow you to browse to dasocial.net:8080 which would be forwarded to port 80 of the other server. Don't use port 81, 90, or any other port below 1024 as they are all assigned for specific purposes (80 being the standard HTTP port, and 8080/8081 being the common alternate HTTP ports).

However, if I understood you correctly, you're simply trying to point a subdomain to a different server, right? To do this properly all you need to do is add a CNAME record to your DNS configuration that points the subdomain to the server. This varies depending on your operating system.

Re: Social Network

Posted: Wed Jun 20, 2012 10:30 am
by tappatekie
I now have a blog http://www.dasocial.net/blog :P, and dreamland.dasocial.net is now live (with iframe :L) It is iframe because it a temp measure for now.
Regarding port forwarding, I already do that, and it's not multiple server (hardware) but multiple server software running on the same hardware server (if that makes sense..) (sorry not to mention that), I can easily do dreamland.dasocial.net:8080 but I want it to be port 80 to make it look cleaner in the address bar, so I guess forwarding the traffic from the main server to the auxiliary will be the key? (which is pretty simple really to do...).
Also, sub-domains are already up and running on the site with "static.dasocial.net" and "[username].dasocial.net". The username one is dynamic, I don't add a CNAME or Sub-domain specification for every user...

Re: Social Network

Posted: Wed Jun 20, 2012 6:18 pm
by dandymcgee
tappatekie wrote:so I guess forwarding the traffic from the main server to the auxiliary will be the key?
Why would you be running two different web servers at the same time? Use apache and configure a virtual host. It's really easy, google it.

Re: Social Network

Posted: Wed Jun 20, 2012 6:25 pm
by tappatekie
dandymcgee wrote:
tappatekie wrote:so I guess forwarding the traffic from the main server to the auxiliary will be the key?
Why would you be running two different web servers at the same time? Use apache and configure a virtual host. It's really easy, google it.
I simply can't use apache, the site itself is built into the webserver code, so essentially, the site is the server.
I need 2 servers running at the same time because 1 is the "live" site which you view at www.dasocial.net and the second is the "beta" site, where all the new code is compiled and ran seperate from the main one.

Re: Social Network

Posted: Thu Jun 21, 2012 9:46 pm
by tappatekie
SQL implimentation is nearly in, I just now need to convert the current database to the new one, which means, I need to take the site down for a few hours.
Social will be offline to all 650 (and counting) users on 22nd June 2012 at 9pm for 2.5 hours (GMT)

Re: Social Network

Posted: Fri Jun 22, 2012 5:05 pm
by tappatekie
This is embarrising :L, I cannot get SQL working 100% with Social in the time I given myself to do it, so the site is not SQL yet. I didn't realise how many subsystems relied on the previous database architecture as well as how it managed entry identities

Re: Social Network

Posted: Sun Jun 24, 2012 7:17 pm
by tappatekie
Just wondering if you guys can help with this very annoying error in the server.

Code: Select all

while(networkStream.DataAvailable) {
   byte[] packet = new byte[512];
   int read = networkStream.Read(packet, 0, packet.Length);
   if(read==0){break;}
   System.Threading.Thread.Sleep(200);
   if(!networkStream.DataAvailable){break;}
}
This code is SUPER simplified of what is actually going on the server, but its the same principle.
It delays for 200ms to basically wait for a socket to catch up with sending more data, which stops the web server from missing the POST data that is sent by some clients.
Is there a more, better way of doing this without having to actually wait for a socket to do something that it might not?.
I'm guessing I could scan the Content-Length header and go from there?.
Also don't say that I could just use HttpListener or use apache/iis...

Re: Social Network

Posted: Sun Jun 24, 2012 9:08 pm
by dandymcgee
Optimally it would be handled asynchronously and event-based. The server would have a listener thread that fires an event any time it receives an incoming request / response. Not sure what the synchronous alternative would be.

Re: Social Network

Posted: Mon Jun 25, 2012 5:29 am
by tappatekie
dandymcgee wrote:Optimally it would be handled asynchronously and event-based. The server would have a listener thread that fires an event any time it receives an incoming request / response. Not sure what the synchronous alternative would be.
Like I said, the example code was super simplified, I already have asynchronous and multi-threaded requests in the code, I also have an event handler for exactly what you said.
I was just asking about receiving the rest of the data correctly without having to wait for 200ms for new data to be received.

Re: Social Network

Posted: Mon Jun 25, 2012 1:28 pm
by tappatekie
I now have 2 pages setup, a twitter and facebook. http://www.facebook.com/DaSocialNet and http://www.twitter.com/DaSocialNet
Also, the site is going offline at 9PM today (GMT) (properly this time :P)

Re: Social Network

Posted: Mon Jun 25, 2012 4:41 pm
by dandymcgee
tappatekie wrote: Like I said, the example code was super simplified, I already have asynchronous and multi-threaded requests in the code, I also have an event handler for exactly what you said.
I was just asking about receiving the rest of the data correctly without having to wait for 200ms for new data to be received.
If it was event based you wouldn't be waiting on your listening thread, you'd create a new one which did the 200ms delay and carry on without any interruption. I can't say much more without knowing the details. You showed a simplified snippet, and I gave a simplified answer. ;)