diy an aim step by step wenjin hu. find your machine ip type the command “ifconfig” – find...
Post on 21-Dec-2015
217 views
TRANSCRIPT
![Page 1: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/1.jpg)
DIY an AIMStep by Step
Wenjin Hu
![Page 2: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/2.jpg)
Find Your Machine IP
• Type the command “ifconfig”– Find your machine’s ip 128.153.14x.xxx
![Page 3: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/3.jpg)
Server draft code ver1.0
• Edit the file “aim.cpp”– #include “server.h”– Server Link( 5001)– Link.connect()– Link.recv_string( arrayname, size)– Display the msg on the terminal– Link. closesocket()
![Page 4: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/4.jpg)
Client draft code ver1.0
• Edit the file “aim.cpp”– #include “client.h”– Client myClient( 5001, “128.153.144.xxx”)– Get the message from the user/terminal– Link.send_string( arrayname)– Link. closesocket()
![Page 5: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/5.jpg)
Server draft code ver2.0
• Edit the file “aim.cpp”while(1){ ……recv…... ……display the msg…}
![Page 6: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/6.jpg)
Client draft code ver2.0
• Edit the file “aim.cpp”while(1)
{ …get the msg from the user… ……send……
}
![Page 7: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/7.jpg)
Server draft code ver3.0
• Edit the file “aim.cpp”while(1){ ……recv…… ……send……}
![Page 8: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/8.jpg)
Client draft code ver3.0
• Edit the file “aim.cpp”while(1)
{ ……send……
…...recv……}
![Page 9: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/9.jpg)
Server draft code ver4.0
• Edit the file “aim.cpp”while(1){ cout<<“Partner: ”;
……recv…… cout<<chattext<<endl; cout<<“Me: ” cin>>chattext; ……send……}
![Page 10: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/10.jpg)
Client draft code ver4.0
• Edit the file “aim.cpp”while(1)
{ cout<<“Me: ”
cin>>chattext; ……send……
cout<<“Partner: ”; …...recv……
cout<<chattext<<endl;}
![Page 11: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/11.jpg)
Draft code ver5.0
• Common cstring function strcmp(str1, str2) will return false if str1 is equal to str2
while( strcmp(chattext, “exit”) ) {
...... }
![Page 12: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/12.jpg)
Server draft code ver6.0• Edit the file “aim.cpp”
while(strcmp(chattext, “exit”) ){
……recv…… cout<<“Partner: ”; cout<<chattext<<endl; if(strcmp(chattext, “exit”) ) { cout<<“Me: ” cin>>chattext; ……send…… }}
![Page 13: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/13.jpg)
Client draft code ver6.0• Edit the file “aim.cpp”
while(strcmp(chattext, “exit”) ) {
cout<<“Me: ” cin>>chattext;
……send…… if(strcmp(chattext, “exit”) ) { …...recv……
cout<<“Partner: ”; cout<<chattext<<endl; }
}
![Page 14: DIY an AIM Step by Step Wenjin Hu. Find Your Machine IP Type the command “ifconfig” – Find your machine’s ip 128.153.14x.xxx](https://reader036.vdocuments.mx/reader036/viewer/2022062516/56649d5f5503460f94a3fe16/html5/thumbnails/14.jpg)
More versions?
• 7.0 – Display partner’s nickname
• 8.0– Let partner send you his/her nickname
• 9.0– use class string instead of cstring (more safe)
• 10.0– Let the string take space or tab
• ……– Whatever you think it is better