os-70-350

os-70-350 Commit Details


Date:2013-12-15 19:21:26 (11 years 8 months ago)
Author:Natalie Adams
Branch:master
Commit:8945570909a7163cafa1049d2fd949f45f7f5c5a
Parents: 979613bab703bea48018eb6e2321cf5e8a014403
Message:Adding a tcp example Renaming buid.sh to build.sh Uodating VC++ build script

Changes:

File differences

bitmap/buid.sh
1
2
3
4
#!/bin/bash
gcc -o main main.c
./main
bitmap/build.sh
1
2
3
4
#!/bin/bash
gcc -o main main.c
./main
cp-Linux/buid.sh
1
2
3
4
#!/bin/bash
gcc -o main main.cpp
./main
cp-Linux/build.sh
1
2
3
4
#!/bin/bash
gcc -o main main.cpp
./main
cp-homework/buid.sh
1
2
3
4
#!/bin/bash
gcc -o main main.cpp
./main
cp-homework/build.sh
1
2
3
4
#!/bin/bash
gcc -o main main.cpp
./main
cp/buid.sh
1
2
3
4
#!/bin/bash
gcc -o main main.cpp
./main test.txt test2.txt
cp/build.sh
1
2
3
4
#!/bin/bash
gcc -o main main.cpp
./main test.txt test2.txt
ptypes-tcp/build.bat
1
2
3
@echo off
call ../vcppbuild.bat client "/link /LIBPATH:../ext/libs ptypes.lib /SUBSYSTEM:CONSOLE"
call ../vcppbuild.bat server "/link /LIBPATH:../ext/libs"
ptypes-tcp/build.sh
1
2
3
4
#!/bin/bash
gcc -o client -lptypes client.cpp
gcc -o server -lptypes server.cpp
ptypes-tcp/client.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <ptypes/pinet.h>
#include <ptypes/ptypes.h>
#include <ptypes/pstreams.h>
#pragma comment(lib, "ptypes.lib")
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "ws2_32.lib")
USING_PTYPES
const int port = 8085;
int main()
{
ipstream client(ipaddress(127, 0, 0, 1), port);
try
{
client.open();
client.putline("Hello");
client.flush();
string rsp = client.line();
pout.putf("Received: %s\n", pconst(rsp));
client.close();
}
catch(estream* e)
{
perr.putf("Error: %s\n", pconst(e->get_message()));
delete e;
}
return 0;
}
ptypes-tcp/server.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <ptypes/ptypes.h>
#include <ptypes/pstreams.h>
#include <ptypes/ptime.h>
#include <ptypes/pinet.h>
#pragma comment(lib, "ptypes.lib")
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "ws2_32.lib")
USING_PTYPES
const int port = 8085;
const int maxtoken = 4096;
void servermain(ipstmserver& svr)
{
ipstream client;
pout.putf("Ready to answer queries on port %d\n", port);
while(true)
{
svr.serve(client);
if (client.get_active())
{
try
{
string req = lowercase(client.line(maxtoken));
if (req == "hello")
{
string host = phostbyaddr(client.get_ip());
if (isempty(host))
host = iptostring(client.get_ip());
client.putline("Hello, the current timestamp is - " + itostring(now()));
client.flush();
pout.putf("%t greeting received from %s (%a)\n",
now(), pconst(host), long(client.get_ip()));
}
client.close();
}
catch(estream* e)
{
perr.putf("Error: %s\n", pconst(e->get_message()));
delete e;
}
}
}
}
int main()
{
ipstmserver svr;
try
{
svr.bindall(port);
servermain(svr);
}
catch(estream* e)
{
perr.putf("FATAL: %s\n", pconst(e->get_message()));
delete e;
}
return 0;
}
ptypes-threads/buid.sh
1
2
3
4
#!/bin/bash
gcc -o main -lptypes main.cpp
./main
ptypes-threads/build.bat
11
2
3
4
52
63
74
@echo off
::pushd ..
::set parent=%cd%
::popd
call ../vcppbuild.bat main "/link /LIBPATH:../ext/libs"
main.exe
pause
ptypes-threads/build.sh
1
2
3
4
#!/bin/bash
gcc -o main -lptypes main.cpp
./main
ptypes-threads/main.cpp
1
1
22
33
44
#include <ptypes\pasync.h>
#include <ptypes/pasync.h>
#include <stdio.h>
#pragma comment(lib, "../ext/libs/ptypes.lib")
vcppbuild.bat
1313
1414
1515
16
16
1717
goto compile
)
:compile
cl.exe /clr /D WIN32 /I"..\ext\include" %1.cpp %2
cl.exe /Zi /nologo /W3 /WX- /O2 /Ob1 /Oy- /D "_CONSOLE" /D "NDEBUG" /D "WIN32" /D "_VC80_UPGRADE=0x0600" /D "_MBCS" /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /I"..\ext\include" %1.cpp %2
del %1.obj

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.58689s using 14 queries.