Jump to content

burtybob

Members
  • Posts

    105
  • Joined

  • Last visited

About burtybob

  • Birthday 02/18/1992

Contact Methods

  • MSN
    bobbob24@hotmail.co.uk

Profile Information

  • Gender
    Male

burtybob's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, I think I understand this but want to check. If I have files register, user.class and dbconnect. If both register and user.class use require_once dbconnect will the dbconnect still only be required on the first time? Ben
  2. As far as I know there is no way to do this in PHP as PHP is executed server side. However, you can do the same with javascript.
  3. hmm That is a good idea to have a tile class. It would definantly make it easier. I have problems with OOP sometimes as when I first started programming they taught us procedural and I am now trying to learn OOP style. Thank you for the advice. Doing it with a tile class also means there is no worrying about the syntax error.
  4. I am wanting to create a game and this is the only thing that I have found hard. The map is of an area of land. Each tile will hold information like what is on that tile such as whether is a building and if so what building or if it doesn't have a building on it then does it have building rights. The first index would be the tile ID and then the second one would be the actual stuff there. So like: map[] = {true,none, false}; where the first value is if it is owned, the second is what is built there and the final one is the status of building rights. Hope that makes sense. I have a horrible tendancy to waffle and make no sense.
  5. I am guessing that I did confuse everyone Here is what i have been playing with: Object map[mapSize][]; for(int i=0;i<mapSize;i++) { map[i][] = {"Element 1","Object 2","Item 3"}; } But the code errors at the map[] ={...}; bit. The error is "Syntax error, insert "}" to complete Block" Hope that clarifies things now.
  6. Firstly I shall presume that you have put "mysite.com" to prevent spam and that in your real shell script you have put the proper one. My second question, although maybe obvious, is does the file exist inside the folder? "No such file or directory" is generally when a file or folder is not located where you tell it to be? So have you tried navigating to that file manually? If that works then I am lost Also the folder being 777 doesn't mean the file is 777
  7. This is probably a really newbie question but what is the best way to do a map that has to contain two arrays. I will try to clarify. I have a map that is X squares wide and X squares high (X = a variable passed to it which can change). I was thinking that the easiest way would be something like an array or vector with X*X elements and then each element having an array of what the map tile holds but different map tiles can hold different amounts of data. I have two vectors: mapArray and mapSquare. I add elements to mapSquare (a and b plus the number the loop is on) so a0 and b0 then a1,b1 etc. The only problem is that every element in the primary array/vector is the exact same if I do .clear() on the vector. If i don't do .clear() on the mapSquare then the mapSquare works but has the previous elements plus all the new ones so a0,b0 even when I want the mapSquare to contain only like a1,b1. Oh dear I don't think anyone is going to be able to understand this . I will try to clarify any bits that anyone is still confused on.
  8. Ok so my mate telnets to the server fine on port 90. grrr I can't do external testing but at least I know it works *yay* Thank you corbin for all the help.
  9. Yeah I did but then it connected to the routers web interface. I shall do a test with a couple of friends later when they are online and see if I can get the client to connect to the server on there machine and then I will post back the results
  10. To add to the confusion: Server running: Website says it can connect and the server does acknowledge it. Server not running: Website says it can't connect. I love creating the impossible problem. Thanks for the huge amount of time you have given to trying to help me with this.
  11. Did that and it then connects to the routers web interface which also runs on port 80. surely if port 90 was blocked then then website wouldn't be able to connect to the server program I had written?
  12. I have apache running on port 80 and so I thought for a laugh I will see if it can connect to it via the outside IP. So changed the port to 80. Hit run. No errors. That is where I got confused because it would appear that neither server OR client are at fault. The router can be ruled out to some degree because the apache port with apache running works. An outside website can connect to the server code. Internal IPs work as well which pushes the blame onto the router but then how does the apache one work. Disabled my firewall, anti virus both together. Nada. Then disabled one and left the other enabled. Nada. Tried changing the ports to no avail . Thanks for your time. ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=90] <= Server socket. Couldn't get I/O for the connection to: xx.xxx.xx.xxx Connection refused: connect <= The clients I/O error message if that is any help. I googled it but couldn't find any help as everyone else with this said the error was that the server wasn't running and they had proved it by using other means like the website to see .
  13. Also telnet can connect via localhost 90 but not my global IP 90. Could it be something to do with the router?
  14. The Server package main; import java.net.*; import java.io.*; public class KnockKnockServer { public static void main(String[] args) throws IOException { ServerSocket serverSocket = null; Socket clientSocket = null; try { serverSocket = new ServerSocket(90); System.out.println(serverSocket); } catch (IOException e) { System.err.println(e.getMessage()); System.exit(1); } try { clientSocket = serverSocket.accept(); System.out.println(clientSocket); } catch (IOException e) { System.err.println("Accept failed."); System.exit(1); } PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); String inputLine, outputLine; KnockKnockProtocol kkp = new KnockKnockProtocol(); outputLine = kkp.processInput("hi"); out.println(outputLine); while ((inputLine = in.readLine()) != null) { outputLine = kkp.processInput(inputLine); out.println(outputLine); } out.close(); in.close(); clientSocket.close(); serverSocket.close(); } } The Client package main; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; public class EchoClient { public static void main(String[] args) throws IOException { String host = "88.108.76.198"; //host = "192.168.0.2"; Socket echoSocket = null; PrintWriter out = null; BufferedReader in = null; try { echoSocket = new Socket(host, 90); out = new PrintWriter(echoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(echoSocket.getInputStream())); } catch (UnknownHostException e) { System.err.println("Don't know about host: "+host+"."); System.exit(1); } catch (IOException e) { System.err.println("Couldn't get I/O for the connection to: "+host); System.err.println(e.getMessage()); System.exit(1); } BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); String userInput; while ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println("echo: " + in.readLine()); } out.close(); in.close(); stdIn.close(); echoSocket.close(); } } These are both from the suns tutorial.
  15. I have two parts of java code one part connects to a server and the other is the server. I start the server part. Ouput in the console in eclipse confirms this. I then start the client with localhost as the connection host and it works again confirmed by no output in the console. I stop both restart the server and try starting the client with localhost replaced with my global IP and it can't connect. The server is definatley running as if I goto can you see me dot org and put in the port (90) it says the port is open and connectable and the server tells me that it recieved the connection. Then I try to connect the client to my HTTP port (80) via the global IP address and it works fine. This has thoroughly confused me. Does anyone have any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.