Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Communications over internet

SergiuHSergiuH Posts: 7Member
I made a game in Pascal, and now I want to play it with my friends over Internet, but I have no idea how to create the connection between the programs over internet. Can you HELP me?!

Comments

  • bpajkbpajk Posts: 156Member
    If you are using a 32 bit compiler you can use unit sockets for this. There are tons of examples on the internet about this. Here is a list of commands:
    http://www.math.uni-hamburg.de/it/software/fpk/units/node14.html
    But this is for Free-Pascal, what compiler are you using?

  • SergiuHSergiuH Posts: 7Member
    I am using the standard compiler found in Borland Pascal 7 (all graphic interface is also in Borland Pascal 7)
  • bpajkbpajk Posts: 156Member
    Compile this. If it works you're OK:)

    [CODE]
    program test;
    uses sockets;
    begin

    end.
    [/CODE]
  • SergiuHSergiuH Posts: 7Member
    "File not found(sockets.tpu)!"
  • bpajkbpajk Posts: 156Member
    Then you don't have the sockets unit. There is a sockets unit for Turbo Pascal out there on the internet... Check if there is a sockets unit for Borland Pascal. But you won't have these problems if you download Free-Pascal or Dev-Pascal. It is free and the syntax is the same as Turbo Pascal.
  • SergiuHSergiuH Posts: 7Member
    I didn't find any socket unit for BP and even for TP, so now I want to translate the entire game in Free Pascal, but I don't know how to initialize the graphic unit (the one in which I can use 256 colors or more)in FP. I would like an example if you know how to do it!
  • bpajkbpajk Posts: 156Member
    : I didn't find any socket unit for BP and even for TP, so now I want to translate the entire game in Free Pascal, but I don't know how to initialize the graphic unit (the one in which I can use 256 colors or more)in FP. I would like an example if you know how to do it!
    :
    The reference for the unit graph and other units are here:
    http://www.math.uni-hamburg.de/it/software/fpk/units/units.html
    Here is a simple example:
    [CODE]
    {$APPTYPE GUI}
    Program inigraph;
    //you can include winmouse, if you want to use a windows mouse
    uses graph, wincrt, windows;

    var
    gd, gm: smallint;

    procedure finish;
    begin
    closegraph;
    halt
    end;


    //DRIVERS: (gd)

    //D1bit = 11;
    //D2bit = 12;
    //D4bit = 13;
    //D6bit = 14; 64 colors Half-brite mode - Amiga
    //D8bit = 15;
    //D12bit = 16; 4096 color modes HAM mode - Amiga
    //D15bit = 17;
    //D16bit = 18;
    //D24bit = 19; not yet supported
    //D32bit = 20; not yet supported
    //D64bit = 21; not yet supported
    //
    //lowNewDriver = 11;
    //highNewDriver = 21;

    //MODES: (gm)
    //detectMode = 30000;
    //m320x200 = 30001;
    //m320x256 = 30002; amiga resolution (PAL)
    //m320x400 = 30003; amiga/atari resolution
    //m512x384 = 30004; mac resolution
    //m640x200 = 30005; vga resolution
    //m640x256 = 30006; amiga resolution (PAL)
    //m640x350 = 30007; vga resolution
    //m640x400 = 30008;
    //m640x480 = 30009;
    //m800x600 = 30010;
    //m832x624 = 30011; mac resolution
    //m1024x768 = 30012;
    //m1280x1024 = 30013;
    //m1600x1200 = 30014;
    //m2048x1536 = 30015;

    //lowNewMode = 30001;
    //highNewMode = 30015;


    begin
    ShowWindow(GetActiveWindow, SW_HIDE); //hides the DOS console
    DetectGraph(gd, gm);
    InitGraph(gd, gm, '');//this will automaticly open the graphical window in 256 colors
    repeat until KeyPressed;
    finish //you have to close the program correctly (the DOS console is stil running)
    end.
    [/CODE]
Sign In or Register to comment.