<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-35782687</id><updated>2012-02-16T06:22:59.788-08:00</updated><category term='udp'/><category term='cryptography'/><category term='ntl'/><category term='tools'/><category term='drawing'/><category term='client'/><category term='javabeans'/><category term='rsa'/><category term='example'/><category term='jsp'/><category term='concurent'/><category term='http'/><category term='compile'/><category term='library'/><category term='side'/><category term='tcp'/><category term='iterativ'/><category term='iterator'/><category term='rectangle'/><category term='function'/><category term='structure'/><category term='server'/><category term='servlet'/><category term='lex'/><category term='network'/><category term='code'/><category term='result'/><category term='port'/><category term='inkscape'/><title type='text'>Computer Programming Interests</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-35782687.post-6732782935634538178</id><published>2010-03-13T07:13:00.000-08:00</published><updated>2010-03-13T07:23:23.964-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='inkscape'/><category scheme='http://www.blogger.com/atom/ns#' term='rectangle'/><category scheme='http://www.blogger.com/atom/ns#' term='drawing'/><title type='text'>Inkscape - How to draw a rectangle with round corners</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;In this period I'm studying Inkscape drawing and I want to show you how to draw a simple rectangle with round corners:&lt;br /&gt;a) select &lt;span style="font-weight:bold;"&gt;rectangle tool&lt;/span&gt; on the left.&lt;br /&gt;b) a &lt;span style="font-weight:bold;"&gt;change bar&lt;/span&gt; will appear:&lt;br /&gt;   *set Rx and Ry to 16 to have round corners on the rectangle you will draw.&lt;br /&gt;   *set Rx and Ry to 0 to go back to normal rectangle.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://students.info.uaic.ro/~paul.guralivu/button_simple_01.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's all.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-6732782935634538178?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/6732782935634538178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=6732782935634538178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6732782935634538178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6732782935634538178'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2010/03/inkscape-how-to-draw-rectangle-with.html' title='Inkscape - How to draw a rectangle with round corners'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-2444194516279687215</id><published>2009-11-19T06:11:00.001-08:00</published><updated>2009-11-19T06:11:43.735-08:00</updated><title type='text'>Eclipse identification FAIL</title><content type='html'>Eclipse identification FAIL&lt;br /&gt;&lt;br /&gt;at here:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://students.info.uaic.ro/~paul.guralivu/error_identification_fail.bmp"&gt;&lt;br /&gt;&lt;br /&gt;Paul.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-2444194516279687215?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/2444194516279687215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=2444194516279687215' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2444194516279687215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2444194516279687215'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2009/11/eclipse-identification-fail.html' title='Eclipse identification FAIL'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-3899631701654058263</id><published>2009-11-19T06:08:00.000-08:00</published><updated>2009-11-19T06:10:33.807-08:00</updated><title type='text'>Eclipse</title><content type='html'>Hello everybody.&lt;br /&gt;Right now I'm learning JSF.&lt;br /&gt;And while working with internationalization and localization and resource bundle I got this nice error:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://students.info.uaic.ro/~paul.guralivu/eclipse_es_throw_exception.bmp"&gt;&lt;br /&gt;&lt;br /&gt;Paul.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-3899631701654058263?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/3899631701654058263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=3899631701654058263' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/3899631701654058263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/3899631701654058263'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2009/11/eclipse.html' title='Eclipse'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-6653897951207172073</id><published>2009-10-17T01:45:00.000-07:00</published><updated>2009-10-17T01:56:59.273-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='javabeans'/><category scheme='http://www.blogger.com/atom/ns#' term='jsp'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='servlet'/><category scheme='http://www.blogger.com/atom/ns#' term='side'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><title type='text'>Combining JSP JavaBeans Servlets</title><content type='html'>Hello everyone,&lt;br /&gt;&lt;br /&gt;I haven't wrote on this blog for a long, long time.&lt;br /&gt;I actually was busy with finishing the computer science faculty.&lt;br /&gt;Now I'm at master studies in computer science.&lt;br /&gt;&lt;br /&gt;One of the first challanges was Java Web Technologies(using J2EE).&lt;br /&gt;JSP, JavaBeans, Servlets.&lt;br /&gt;A Web application can be wrote as a MVC.&lt;br /&gt;Control-Servlet&lt;br /&gt;JSP-View&lt;br /&gt;JavaBeans-Model.&lt;br /&gt;&lt;br /&gt;The comunication between JSP and Servlets is made using JavaBeans:&lt;br /&gt;a) A JavaBeans is a public class that:&lt;br /&gt;The required conventions are:&lt;br /&gt;*The class must have a public default constructor. This allows easy instantiation within editing and activation frameworks.&lt;br /&gt;*The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.&lt;br /&gt;*The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.&lt;br /&gt;&lt;br /&gt;//example:&lt;br /&gt;/**&lt;br /&gt; * Class &lt;code&gt;PersonBean&lt;/code&gt;.&lt;br /&gt; */&lt;br /&gt;public class PersonBean implements java.io.Serializable {&lt;br /&gt; &lt;br /&gt;    private String name;&lt;br /&gt; &lt;br /&gt;    private boolean deceased;&lt;br /&gt; &lt;br /&gt;    /** No-arg constructor (takes no arguments). */&lt;br /&gt;    public PersonBean() {&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    /**&lt;br /&gt;     * Property &lt;code&gt;name&lt;/code&gt; (note capitalization) readable/writable.&lt;br /&gt;     */&lt;br /&gt;    public String getName() {&lt;br /&gt;        return this.name;&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    /**&lt;br /&gt;     * Setter for property &lt;code&gt;name&lt;/code&gt;.&lt;br /&gt;     * @param name&lt;br /&gt;     */&lt;br /&gt;    public void setName(final String name) {&lt;br /&gt;        this.name = name;&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    /**&lt;br /&gt;     * Getter for property "deceased"&lt;br /&gt;     * Different syntax for a boolean field (is vs. get)&lt;br /&gt;     */&lt;br /&gt;    public boolean isDeceased() {&lt;br /&gt;        return this.deceased;&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    /**&lt;br /&gt;     * Setter for property &lt;code&gt;deceased&lt;/code&gt;.&lt;br /&gt;     * @param deceased&lt;br /&gt;     */&lt;br /&gt;    public void setDeceased(final boolean deceased) {&lt;br /&gt;        this.deceased = deceased;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;b)a JSP page using a JavaBean:&lt;br /&gt;&lt;% // Use of PersonBean in a JSP. %&gt;&lt;br /&gt;&lt;jsp:useBean id="person" class="PersonBean" scope="session"/&gt;&lt;br /&gt;&lt;jsp:setProperty name="person" property="*"/&gt;&lt;br /&gt; &lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;Name: &lt;jsp:getProperty name="person" property="name"/&gt;&lt;br/&gt;&lt;br /&gt;Deceased? &lt;jsp:getProperty name="person" property="deceased"/&gt;&lt;br/&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;form name="beanTest" method="POST" action="PersonServlet"&gt;&lt;br /&gt;Enter a name: &lt;input type="text" name="name" size="50"&gt;&lt;br/&gt;&lt;br /&gt;Choose an option:&lt;br /&gt;&lt;select name="deceased"&gt;&lt;br /&gt; &lt;option value="false"&gt;Alive&lt;/option&gt;&lt;br /&gt; &lt;option value="true"&gt;Dead&lt;/option&gt;&lt;br /&gt;&lt;/select&gt;&lt;br /&gt;&lt;input type="submit" value="Test the Bean"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;br /&gt;c)The Servlet-I will only list the part necessary to take the bean and use it:&lt;br /&gt;public void doGet(HttpServletRequest request, HttpServletResponse response)&lt;br /&gt;		throws ServletException, IOException {&lt;br /&gt;	HttpSession session=request.getSession();&lt;br /&gt;        PersonBean pers=(PersonBean)session.getAttribute("person");&lt;br /&gt;        out.print(pres.getName());&lt;br /&gt;       &lt;br /&gt;        //we also can set and send a bean&lt;br /&gt;        session.setAttribute("person2", pers);&lt;br /&gt;        getServletContext().getRequestDispatcher("Result.jsp").forward(request, response);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Paul.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-6653897951207172073?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/6653897951207172073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=6653897951207172073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6653897951207172073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6653897951207172073'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2009/10/combining-jsp-javabeans-servlets.html' title='Combining JSP JavaBeans Servlets'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-1006950525311637700</id><published>2008-07-27T13:14:00.000-07:00</published><updated>2008-07-30T23:08:49.842-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><title type='text'>Tools for my Selenium tests</title><content type='html'>Here are my tools:&lt;br /&gt;&lt;br /&gt;Windows XP,Vista &amp; Ubuntu 8.04&lt;br /&gt;Eclipse(I forgot to mention that I write my tests in java): with Subversion plugin&amp;Maven plugin.&lt;br /&gt;Maven tool installed as standalone with .m2 repository directory.&lt;br /&gt;Mozilla Firefox(2&amp;3 - you will understand why later): &lt;br /&gt;-with next plugins and addons:&lt;br /&gt; *Selenium IDE - will help a lot;&lt;br /&gt; *Firebug - If you have Ajax code with Source View of Mozilla you will not see the source and firebug is here to save us;&lt;br /&gt; *XPath Checker for short XPath to that element;&lt;br /&gt; *XPather Browser for the long XPath to element.&lt;br /&gt;&lt;br /&gt;Paul.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-1006950525311637700?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/1006950525311637700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=1006950525311637700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/1006950525311637700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/1006950525311637700'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/07/tools-for-my-selenium-tests.html' title='Tools for my Selenium tests'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-6396071385810684300</id><published>2008-07-25T02:15:00.000-07:00</published><updated>2008-07-25T02:18:05.128-07:00</updated><title type='text'>Selenium tests for Summer.</title><content type='html'>This summer I'm gone write selenium tests for a web application: XWIKI.&lt;br /&gt;So this summer I'll learn you about selenium tests.&lt;br /&gt;&lt;br /&gt;Paul.&lt;br /&gt;&lt;br /&gt;P.S.: Sorry about java posts that I've promised. I promise that I will tell you more about it later when I will learn how to write a web application with java technologies.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-6396071385810684300?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/6396071385810684300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=6396071385810684300' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6396071385810684300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6396071385810684300'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/07/selenium-tests-for-summer.html' title='Selenium tests for Summer.'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-7854671090545338083</id><published>2008-05-04T13:46:00.000-07:00</published><updated>2008-05-06T00:19:55.306-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iterator'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>More about iterators</title><content type='html'>Iterators(C++) can be definied for object of classes from std.&lt;br /&gt;Examples: vector, list, map, etc.&lt;br /&gt;&lt;br /&gt;Example for vector:&lt;br /&gt;//header&lt;br /&gt;#include vector&lt;br /&gt;&lt;br /&gt;//type definition&lt;br /&gt;typedef vector&lt;int&gt; vect;&lt;br /&gt;//type declaration&lt;br /&gt;vect v(20);&lt;br /&gt;&lt;br /&gt;//iterator definition&lt;br /&gt;typedef vect::iterator vectiter;&lt;br /&gt;//iterator declaration&lt;br /&gt;vectiter v;&lt;br /&gt;&lt;br /&gt;//iterator use&lt;br /&gt;//listing all the values in vector&lt;br /&gt;for(vectiter i=vect.begin() ; i!=vect.end() ; ++i ){&lt;br /&gt;  //two ways:&lt;br /&gt;  cout&lt;&amp;lt; i-&amp;gt;list();&lt;br /&gt;  cout&lt;&lt;(*i).list();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//other iterator use&lt;br /&gt;//deleting a value from vector&lt;br /&gt;vectiter i=vect.find(new int(5));&lt;br /&gt;if(i==vect.end())&lt;br /&gt;{&lt;br /&gt;  cout&lt;&lt;"The element doesn't exist";&lt;br /&gt;}&lt;br /&gt;else{&lt;br /&gt;  vect.erase(i);&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-7854671090545338083?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/7854671090545338083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=7854671090545338083' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7854671090545338083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7854671090545338083'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/05/more-about-iterators.html' title='More about iterators'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-4058411244668283921</id><published>2008-04-29T23:26:00.000-07:00</published><updated>2008-04-30T01:53:18.318-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='lex'/><title type='text'>A lex example for Simple language</title><content type='html'>Simple language looks like this:&lt;br /&gt;LET&lt;br /&gt;declarations of variables.&lt;br /&gt;IN&lt;br /&gt;statements;&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;declarations of variables:&lt;br /&gt;INTEGER i.&lt;br /&gt;&lt;br /&gt;statements:&lt;br /&gt;READ i;&lt;br /&gt;&lt;br /&gt;the lex example that generates a lexical analyzer:&lt;br /&gt;ident [a-z][a-zA-Z0-9]*&lt;br /&gt;digit [0-9]&lt;br /&gt;number [0-9][0-9]*&lt;br /&gt;%%&lt;br /&gt;"LET"|"IN"|"END"|"INTEGER"|"READ"|"WRITE" { printf("Key word: %s",yytext); }&lt;br /&gt;("INTEGER")(" ")+({ident})(" ")* { printf("Token variable declaration: %d",yytext); }&lt;br /&gt;("READ")(" ")*({ident})(" ")*(";") { printf("Token : %s",yytext); }&lt;br /&gt;("WRITE")(" ")*({ident})(" ")*(";") { printf("Token : %s",yytext); }&lt;br /&gt;%%&lt;br /&gt;main(char *argv[])&lt;br /&gt;{&lt;br /&gt;  yyin=fopen(argv[1],"r");&lt;br /&gt;  yyout=fopen(argv[2],"w");&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-4058411244668283921?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/4058411244668283921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=4058411244668283921' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/4058411244668283921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/4058411244668283921'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/04/lex-example-for-simple-language.html' title='A lex example for Simple language'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-7533273601981865871</id><published>2008-04-29T23:13:00.000-07:00</published><updated>2008-04-29T23:25:46.746-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='lex'/><title type='text'>A regular expression for lex</title><content type='html'>Now I'm real busy, but I will still write about lex.&lt;br /&gt;A regular expression is used for identification of patterns in a text.&lt;br /&gt;There are some rules:&lt;br /&gt;* - it means that the block that has this at the end can appear 0 times or many times;&lt;br /&gt;+ - it means that the block that has this at the end can appear 1 times or many times;&lt;br /&gt;? - it means that the block that has this at the end can appear 0 time or 1 time;&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;//this is a lex example&lt;br /&gt;("for")(" ")*("(")(";")(";")(")")(" ")*("(")&lt;br /&gt;&lt;br /&gt;this regular expression is for:&lt;br /&gt;for(;;){&lt;br /&gt;or &lt;br /&gt;for (;;) {&lt;br /&gt;&lt;br /&gt;I've put the (" ")* because there can be as many spaces as 0 or many.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-7533273601981865871?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/7533273601981865871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=7533273601981865871' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7533273601981865871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7533273601981865871'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/04/regular-expression-for-lex.html' title='A regular expression for lex'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-8219356991586322018</id><published>2008-03-17T13:16:00.000-07:00</published><updated>2008-03-17T13:25:22.791-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lex'/><title type='text'>About lex</title><content type='html'>Lex is tool that is generating lexical analyzers.&lt;br /&gt;It generally works with regular expressions.&lt;br /&gt;Having a set of rules.&lt;br /&gt;&lt;br /&gt;Main structure:&lt;br /&gt;Definition section&lt;br /&gt;%%&lt;br /&gt;Rules section&lt;br /&gt;%%&lt;br /&gt;C/C++/Java code section&lt;br /&gt;&lt;br /&gt;This tool is implemented for the common know programming languages:&lt;br /&gt;- C/C++ -PCLex,Flex&lt;br /&gt;- Java - JLex.&lt;br /&gt;&lt;br /&gt;Addresses were you can download lex:&lt;br /&gt;http://www.cs.princeton.edu/~appel/modern/java/JLex/(for JLex)&lt;br /&gt;http://flex.sourceforge.net/ (Flex).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-8219356991586322018?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/8219356991586322018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=8219356991586322018' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8219356991586322018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8219356991586322018'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/03/about-lex.html' title='About lex'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-7438929237368366351</id><published>2008-03-17T13:08:00.000-07:00</published><updated>2008-03-17T13:10:17.909-07:00</updated><title type='text'>I haven't wrote for a while</title><content type='html'>Being a little busy I forgot about the blog.&lt;br /&gt;&lt;br /&gt;The next posts I've been thinking are:&lt;br /&gt;-Lex: who to use it(4-6 posts).&lt;br /&gt;-Java Interface - How to send a method as parameter(2 posts).&lt;br /&gt;&lt;br /&gt;I'll see what will be next.&lt;br /&gt;&lt;br /&gt;Paul.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-7438929237368366351?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/7438929237368366351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=7438929237368366351' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7438929237368366351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7438929237368366351'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/03/i-havent-wrote-for-while.html' title='I haven&apos;t wrote for a while'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-6503809077164148808</id><published>2008-02-15T07:47:00.001-08:00</published><updated>2008-02-15T10:21:11.260-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rsa'/><category scheme='http://www.blogger.com/atom/ns#' term='cryptography'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>RSA with NTL(in english)</title><content type='html'>#include &amp;lt;ntl/zz.h&amp;gt;&lt;br /&gt;NTL_CLIENT&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ZZ power2(ZZ m,ZZ pow,ZZ n){&lt;br /&gt;ZZ i,m2;&lt;br /&gt;i=1;m2=1;&lt;br /&gt;while(i&lt;=pow){&lt;br /&gt;m2=(m2*m)%n;&lt;br /&gt;i++;&lt;br /&gt;}&lt;br /&gt;return m2;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;int main(void){&lt;br /&gt;ZZ p,q,d,e,n,fi,msg,cr,dr;&lt;br /&gt;&lt;br /&gt;cout&amp;lt;&amp;lt;"Reading p and q:";&lt;br /&gt;cin&amp;gt;&amp;gt;p;&lt;br /&gt;cin&amp;gt;&amp;gt;q;&lt;br /&gt;n=p*q;&lt;br /&gt;fi=(p-1)*(q-1);&lt;br /&gt;cout&amp;lt;&amp;lt;"n:"&amp;lt;&amp;lt;n&amp;lt;&amp;lt;":fi:"&amp;lt;&amp;lt;fi&amp;lt;&amp;lt;endl;&lt;br /&gt;cout&amp;lt;&amp;lt;"Reading message(numbers):";&lt;br /&gt;cin&amp;gt;&amp;gt;msg;&lt;br /&gt;cout&amp;lt;&amp;lt;"Reading d:";&lt;br /&gt;cin&amp;gt;&amp;gt;d;&lt;br /&gt;cout&amp;lt;&amp;lt;"Inverse modulare:";&lt;br /&gt;e=InvMod(d, fi);&lt;br /&gt;cout&amp;lt;&amp;lt;e&amp;lt;&amp;lt;endl;&lt;br /&gt;cout&amp;lt;&amp;lt;"Cryptotext:";&lt;br /&gt;cr=PowerMod(msg,e,n);&lt;br /&gt;cout&amp;lt;&amp;lt;cr&amp;lt;&amp;lt;endl;&lt;br /&gt;cout&amp;lt;&amp;lt;"DeCrypted:";&lt;br /&gt;dr=PowerMod(cr,d,n);&lt;br /&gt;cout&amp;lt;&amp;lt;dr&amp;lt;&amp;lt;endl;&lt;br /&gt;&lt;br /&gt;ZZ x,yq,yp,dq,dp,i,c1,c2,x1,x2;&lt;br /&gt;dq=d%(q-1);&lt;br /&gt;dp=d%(p-1);&lt;br /&gt;i=1;yp=1;&lt;br /&gt;while(i&lt;=dp){&lt;br /&gt;yp*=cr;&lt;br /&gt;yp%=p;&lt;br /&gt;i++;&lt;br /&gt;}&lt;br /&gt;i=1;yq=1;&lt;br /&gt;while(i&lt;=dq){&lt;br /&gt;yq*=cr;&lt;br /&gt;yq%=q;&lt;br /&gt;i++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;c1=q%p;&lt;br /&gt;c2=p%q;&lt;br /&gt;&lt;br /&gt;int i2,j2;&lt;br /&gt;i2=0;j2=0;&lt;br /&gt;while(c1*i2-yp!=j2*p){&lt;br /&gt;if(j2&amp;lt;p) j2++;&lt;br /&gt;else {j2=0; i2++;}&lt;br /&gt;}&lt;br /&gt;x1=i2;&lt;br /&gt;i2=0;j2=0;&lt;br /&gt;while(c2*i2-yq!=j2*q){&lt;br /&gt;if(j2&amp;lt;q) j2++;&lt;br /&gt;else {j2=0; i2++;}&lt;br /&gt;}&lt;br /&gt;x2=i2;&lt;br /&gt;&lt;br /&gt;x=(x1*q+p*x2)%(q*p);&lt;br /&gt;cout&amp;lt;&amp;lt;"Decrypted cu TCR:"&amp;lt;&amp;lt;x&amp;lt;&amp;lt;endl;&lt;br /&gt;return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-6503809077164148808?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/6503809077164148808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=6503809077164148808' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6503809077164148808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6503809077164148808'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/02/rsa-with-ntlin-english.html' title='RSA with NTL(in english)'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-5912832107448287623</id><published>2008-02-15T07:40:00.000-08:00</published><updated>2008-02-15T07:46:50.639-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='result'/><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='rsa'/><category scheme='http://www.blogger.com/atom/ns#' term='cryptography'/><title type='text'>Result for RSA(with small numbers)</title><content type='html'>For:&lt;br /&gt;p=1511&lt;br /&gt;q=1409&lt;br /&gt;d=17&lt;br /&gt;&lt;br /&gt;x=1704&lt;br /&gt;&lt;br /&gt;n=2128999&lt;br /&gt;fi=2126080&lt;br /&gt;e=1875953&lt;br /&gt;&lt;br /&gt;Cryptotext=219017&lt;br /&gt;Decrypted=1704&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-5912832107448287623?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/5912832107448287623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=5912832107448287623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/5912832107448287623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/5912832107448287623'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/02/result-for-rsawith-small-numbers.html' title='Result for RSA(with small numbers)'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-8080078086229979436</id><published>2008-02-15T07:29:00.001-08:00</published><updated>2008-02-15T07:34:15.739-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rsa'/><category scheme='http://www.blogger.com/atom/ns#' term='cryptography'/><category scheme='http://www.blogger.com/atom/ns#' term='ntl'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>RSA with NTL</title><content type='html'>#include &amp;lt;ntl/zz.h&amp;gt;&lt;br /&gt;NTL_CLIENT&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ZZ power2(ZZ m,ZZ pow,ZZ n){&lt;br /&gt;    ZZ i,m2;&lt;br /&gt;    i=1;m2=1;&lt;br /&gt;    while(i&lt;=pow){&lt;br /&gt;        m2=(m2*m)%n;&lt;br /&gt;        i++;&lt;br /&gt;    }&lt;br /&gt;    return m2;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;int main(void){&lt;br /&gt;    ZZ p,q,d,e,n,fi,msg,cr,dr;&lt;br /&gt;&lt;br /&gt;    cout&amp;lt;&amp;lt;"Citire p si q:";&lt;br /&gt;    cin&amp;gt;&amp;gt;p;&lt;br /&gt;    cin&amp;gt;&amp;gt;q;&lt;br /&gt;    n=p*q;&lt;br /&gt;    fi=(p-1)*(q-1);&lt;br /&gt;    cout&amp;lt;&amp;lt;"n:"&amp;lt;&amp;lt;n&amp;lt;&amp;lt;":fi:"&amp;lt;&amp;lt;fi&amp;lt;&amp;lt;endl;&lt;br /&gt;    cout&amp;lt;&amp;lt;"Citire mesaj:";&lt;br /&gt;    cin&amp;gt;&amp;gt;msg;&lt;br /&gt;    cout&amp;lt;&amp;lt;"Citire d:";&lt;br /&gt;    cin&amp;gt;&amp;gt;d;&lt;br /&gt;    cout&amp;lt;&amp;lt;"Invers modular:";&lt;br /&gt;    e=InvMod(d, fi);&lt;br /&gt;    cout&amp;lt;&amp;lt;e&amp;lt;&amp;lt;endl;&lt;br /&gt;    cout&amp;lt;&amp;lt;"Criptat:";&lt;br /&gt;    cr=PowerMod(msg,e,n);&lt;br /&gt;    cout&amp;lt;&amp;lt;cr&amp;lt;&amp;lt;endl;   &lt;br /&gt;    cout&amp;lt;&amp;lt;"DeCriptat:";&lt;br /&gt;    dr=PowerMod(cr,d,n);&lt;br /&gt;    cout&amp;lt;&amp;lt;dr&amp;lt;&amp;lt;endl;&lt;br /&gt;&lt;br /&gt;    ZZ x,yq,yp,dq,dp,i,c1,c2,x1,x2;&lt;br /&gt;    dq=d%(q-1);&lt;br /&gt;    dp=d%(p-1);&lt;br /&gt;    i=1;yp=1;&lt;br /&gt;    while(i&lt;=dp){&lt;br /&gt;        yp*=cr;&lt;br /&gt;        yp%=p;&lt;br /&gt;        i++;&lt;br /&gt;    }   &lt;br /&gt;    i=1;yq=1;&lt;br /&gt;    while(i&lt;=dq){&lt;br /&gt;        yq*=cr;&lt;br /&gt;        yq%=q;&lt;br /&gt;        i++;&lt;br /&gt;    }&lt;br /&gt;           &lt;br /&gt;    c1=q%p;&lt;br /&gt;    c2=p%q;&lt;br /&gt;&lt;br /&gt;    int i2,j2;&lt;br /&gt;    i2=0;j2=0;&lt;br /&gt;    while(c1*i2-yp!=j2*p){&lt;br /&gt;        if(j2&amp;lt;p) j2++;&lt;br /&gt;        else {j2=0; i2++;}&lt;br /&gt;    }&lt;br /&gt;    x1=i2;&lt;br /&gt;    i2=0;j2=0;&lt;br /&gt;    while(c2*i2-yq!=j2*q){&lt;br /&gt;        if(j2&amp;lt;&amp;lt;q) j2++;&lt;br /&gt;        else {j2=0; i2++;}&lt;br /&gt;    }&lt;br /&gt;    x2=i2;&lt;br /&gt;&lt;br /&gt;    x=(x1*q+p*x2)%(q*p);&lt;br /&gt;    cout&amp;lt;&amp;lt;"Decriptare cu TCR:"&amp;lt;&amp;lt;x&amp;lt;&amp;lt;endl;&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-8080078086229979436?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/8080078086229979436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=8080078086229979436' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8080078086229979436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8080078086229979436'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/02/rsa-with-ntl.html' title='RSA with NTL'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-7285900647050633488</id><published>2008-02-11T07:18:00.000-08:00</published><updated>2008-02-11T07:25:22.401-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='ntl'/><title type='text'>NTL functions</title><content type='html'>//to generate Inverse Modular for a number&lt;br /&gt;e=InvMod(d,fi)&lt;br /&gt;&lt;br /&gt;//to raise a number at a power&lt;br /&gt;y=PowerMod(x,n)&lt;br /&gt;&lt;br /&gt;//to generate prime numbers&lt;br /&gt;GenPrime().&lt;br /&gt;&lt;br /&gt;More about programming interests and examples:&lt;br /&gt;http://www.shoup.net/ntl/doc/tour-struct.html&lt;br /&gt;http://www.shoup.net/ntl/doc/tour-examples.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-7285900647050633488?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/7285900647050633488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=7285900647050633488' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7285900647050633488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7285900647050633488'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/02/ntl-functions.html' title='NTL functions'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-8321961259871505357</id><published>2008-02-11T06:57:00.000-08:00</published><updated>2008-02-15T07:34:44.587-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rsa'/><category scheme='http://www.blogger.com/atom/ns#' term='cryptography'/><title type='text'>RSA cryptosystem.</title><content type='html'>We will work a small example with NTL.  And that will  be  RSA  cryptosystem.&lt;br /&gt;&lt;br /&gt;RSA is a cryptosystem with public-private key:&lt;br /&gt;-public key (n,e);&lt;br /&gt;-private key (p,q,d,fi).&lt;br /&gt;&lt;br /&gt;p,q are large prime numbers(we generate them).&lt;br /&gt;we also choose d.&lt;br /&gt;&lt;br /&gt;n=p*q;&lt;br /&gt;fi=(p-1)*(q-1);&lt;br /&gt;e=InvMod(d,fi);&lt;br /&gt;(e*d)%fi=1.&lt;br /&gt;&lt;br /&gt;x-message.&lt;br /&gt;y-crypted message.&lt;br /&gt;y=(x at power e)%n.&lt;br /&gt;x1-decrypted message.&lt;br /&gt;x1=(y at power d)%n.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-8321961259871505357?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/8321961259871505357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=8321961259871505357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8321961259871505357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8321961259871505357'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/02/rsa-cryptosystem.html' title='RSA cryptosystem.'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-354208513783599153</id><published>2008-02-03T05:40:00.000-08:00</published><updated>2008-02-03T09:09:04.216-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ntl'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>How to use NTL</title><content type='html'>Now that we compile one version of NTL(later I will show for the rest of the versions) let's see how we can use it.&lt;br /&gt;&lt;br /&gt;We will still use Visual C++ 6.0 and the compiled file ntl.lib.&lt;br /&gt;&lt;br /&gt;Let's begin.&lt;br /&gt;&lt;br /&gt;Step 1:&lt;br /&gt;Create a new project.&lt;br /&gt;Named it and choose Win32 Console Application.&lt;br /&gt;&lt;br /&gt;Step 2:&lt;br /&gt;Add to the project the file ntl.lib(Project -&gt; Add -&gt; Files).&lt;br /&gt;&lt;br /&gt;Step 3:&lt;br /&gt;We also have to include to the project the \\include directory.&lt;br /&gt;The same way as we did when we compiled the ntl library.&lt;br /&gt;Project -&gt;Settings -&gt; C/C++&lt;br /&gt;Category:Preprocessor.&lt;br /&gt;Additional include directories: c:\\ntl\\WinNTL-yyy\\include.&lt;br /&gt;&lt;br /&gt;Step 4:&lt;br /&gt;When we like to work with ntl functions we have to write this lines of code:&lt;br /&gt;&lt;br /&gt;#include &amp;lt;NTL/ZZ.h&amp;gt; &lt;ntl h=""&gt;&lt;br /&gt;NTL_CLIENT.&lt;br /&gt;&lt;br /&gt;Paul.&lt;/ntl&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-354208513783599153?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/354208513783599153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=354208513783599153' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/354208513783599153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/354208513783599153'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/02/how-to-use-ntl.html' title='How to use NTL'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-7658242736243935735</id><published>2008-02-03T05:16:00.000-08:00</published><updated>2008-02-03T05:39:28.762-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ntl'/><category scheme='http://www.blogger.com/atom/ns#' term='compile'/><title type='text'>How to compile NTL</title><content type='html'>I've been a bit busy with school exams, so I didn't wrote on the blog.&lt;br /&gt;&lt;br /&gt;First compilation will be for Visual Studio 6.0 versions 5.1 to 5.3.2 of NTL.&lt;br /&gt;Save the files in c:\\ntl(you can save it anywhere else only to know exactly).&lt;br /&gt;&lt;br /&gt;Step 1:&lt;br /&gt;Make a new project(File-&gt;New-Project)&lt;br /&gt;give it the name you like and choose the project type: Win 32 static library. In rest leave the settings as they are.&lt;br /&gt;&lt;br /&gt;Step 2:&lt;br /&gt;Add the NTL files to the project(Project -&gt; Add to Project -&gt; Files).&lt;br /&gt;Files are at c:\\ntl\\WinNTL-yyy\\src.&lt;br /&gt;&lt;br /&gt;Step 3:&lt;br /&gt;Important step because now we will include the headers files.&lt;br /&gt;Project -&gt;Settings -&gt; C/C++&lt;br /&gt;Category:Preprocessor.&lt;br /&gt;Additional include directories: c:\\ntl\\WinNTL-yyy\\include.&lt;br /&gt;&lt;br /&gt;Now build.&lt;br /&gt;&lt;br /&gt;The result is a file: ntl.lib.&lt;br /&gt;&lt;br /&gt;A version of this compilation can be found here:&lt;br /&gt;&lt;a href="http://students.info.uaic.ro/%7Epaul.guralivu/ntl3_2.lib"&gt; http://students.info.uaic.ro/~paul.guralivu/ntl3_2.lib&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Paul.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-7658242736243935735?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/7658242736243935735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=7658242736243935735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7658242736243935735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7658242736243935735'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/02/how-to-compile-ntl.html' title='How to compile NTL'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-2271447880545954916</id><published>2008-01-21T07:38:00.000-08:00</published><updated>2008-01-22T01:16:24.598-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ntl'/><title type='text'>More about NTL</title><content type='html'>To keep informations safe you have to use efficent crypting algorithms.Nowadays anybody can break ancient cryptosystem in 10 min with an usual pc. It's been proven that you have to work with big numbers(for dss you need a number between 2 at the power 512 and 2 at the power 1024). With a simple pc this are numbers that can't be counted, because the computers&lt;br /&gt;doesn't have the structure for it.&lt;br /&gt;&lt;br /&gt;So somebody decide to write a library about it.&lt;br /&gt;Called NTL - A Library for doing Number Theory.&lt;br /&gt;&lt;br /&gt;In this tutorial I'll show you how to compile it and use it.&lt;br /&gt;&lt;br /&gt;You can find more about it at:&lt;br /&gt;&lt;a href="http://www.shoup.net/ntl/"&gt;http://www.shoup.net/ntl/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-2271447880545954916?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/2271447880545954916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=2271447880545954916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2271447880545954916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2271447880545954916'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/more-about-ntl.html' title='More about NTL'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-6935487912785661854</id><published>2008-01-17T07:29:00.000-08:00</published><updated>2008-01-17T07:31:41.357-08:00</updated><title type='text'>Next time</title><content type='html'>I will come back at servers later.&lt;br /&gt;&lt;br /&gt;I will post some servers-clients that I wrote.&lt;br /&gt;&lt;br /&gt;Next time I will post about NTL library used in cryptography for big numbers.&lt;br /&gt;This isn't the only domain in which is used. There are many others.&lt;br /&gt;&lt;br /&gt;And I will post rsa public-key cryptosystem in C with NTL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-6935487912785661854?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/6935487912785661854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=6935487912785661854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6935487912785661854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6935487912785661854'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/next-time.html' title='Next time'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-6068655275212644596</id><published>2008-01-17T07:14:00.000-08:00</published><updated>2008-01-17T07:34:04.361-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='concurent'/><title type='text'>Our first server</title><content type='html'>//the server will only support to clients with will send messages one to the other&lt;br /&gt;//and we will make 1 son for the second client&lt;br /&gt;&lt;br /&gt;//we include the same libraries with the same functions&lt;br /&gt;//just 2 more sys/socket.h and sys/types.h&lt;br /&gt;#include                        &amp;lt;stdio.h&amp;gt; &lt;stdio.h&gt;&lt;br /&gt;#include &lt;/stdio.h&gt;&amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;#include &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;strings.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;#include &lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;string.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;#include &lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;netdb.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;#include &lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;errno.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;#include &lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;fcntl.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;#include &lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;#include &lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;sys/types.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;#include &lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;signal.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;&lt;fcntl.h&gt;#include &lt;/fcntl.h&gt;&lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;errno.h&amp;gt;&lt;br /&gt;extern int errno;&lt;br /&gt;&lt;br /&gt;//we declare int argc and char *argv[], because we will give the port on the command line&lt;br /&gt;int main(int argc,char *argv[]){&lt;br /&gt;  int i,sk,walking[20],ct,pid[2],m,l;&lt;br /&gt;  struct sockaddr_in st1,st2;&lt;br /&gt;  char buf[1000],buf2[1000]={"Client1:"},buf3[1000]={"Client2:"};&lt;br /&gt;&lt;br /&gt;  //we create the socket&lt;br /&gt;  if((sk=socket(PF_INET,SOCK_STREAM,0))==-1){&lt;br /&gt;      perror("Eroare la socket.");&lt;br /&gt;      exit(1);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;      //we create the structure with the parameters for the server&lt;br /&gt;      //with parameters like port,types of address accepted&lt;br /&gt;      st1.sin_addr.s_addr=htonl(INADDR_ANY);&lt;br /&gt;      st1.sin_family=AF_INET;&lt;br /&gt;      st1.sin_port=htons(atoi(argv[1]));&lt;br /&gt;&lt;br /&gt;      //we open the server to connections &lt;br /&gt;      if(bind(sk,(struct sockaddr*)&amp;amp;st1,sizeof(st1))==-1){&lt;br /&gt;          perror("Eroare la bind.");&lt;br /&gt;          exit(1);&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      if(listen(sk,5)==-1){&lt;br /&gt;          perror("Eroare la LISTEN.");&lt;br /&gt;          exit(1);&lt;br /&gt;      }&lt;br /&gt;  &lt;br /&gt;      //accepting the first client&lt;br /&gt;      if((walking[0]=accept(sk,NULL,NULL))==-1){&lt;br /&gt;          perror("Eroare la accept.");&lt;br /&gt;          exit(1);&lt;br /&gt;      }&lt;br /&gt;         //we accept the second client&lt;br /&gt;          walking[1]=accept(sk,NULL,NULL);&lt;br /&gt;          pid[0]=fork();&lt;br /&gt;          if(pid[0]==0){&lt;br /&gt;          bzero(buf,1000);&lt;br /&gt;              //the first client reads what the second sent to him&lt;br /&gt;          while(read(walking[0],buf,sizeof(buf))&gt;0){&lt;br /&gt;          for(m=0,l=10;m&lt;(int)strlen(buf);m++,l++)                 buf2[l]=buf[m];                       &lt;br /&gt;write(walking[1],buf2,sizeof(buf));             }                    }                         pid[1]=fork();                    if(pid[1]==0){             bzero(buf,1000);&lt;br /&gt;//the second client reads what the first send him            &lt;br /&gt;while(read(walking[1],buf,sizeof(buf))&gt;0){&lt;br /&gt;          for(m=0,l=10;m&lt;(int)strlen(buf);m++,l++)&lt;br /&gt;              buf3[l]=buf[m];&lt;br /&gt;//sending the message to the first client&lt;br /&gt;          write(walking[0],buf3,sizeof(buf));&lt;br /&gt;          }&lt;br /&gt;  } &lt;br /&gt; &lt;br /&gt;  close(sk);&lt;br /&gt;  return 0;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-6068655275212644596?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/6068655275212644596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=6068655275212644596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6068655275212644596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6068655275212644596'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/our-first-server.html' title='Our first server'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-1538687741480308323</id><published>2008-01-13T11:33:00.000-08:00</published><updated>2008-01-17T07:12:03.627-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='structure'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='concurent'/><title type='text'>A few structs that we will use</title><content type='html'>//there are 2 important structs that are used in day-to-day programming&lt;br /&gt;struct sockaddr{&lt;br /&gt;  uint8_t sa_len;&lt;br /&gt;  sa_family_t sa_family;&lt;br /&gt;  char sa_data[14];&lt;br /&gt;};&lt;br /&gt;//but the structure we will really use is&lt;br /&gt;struct sockaddr_in{&lt;br /&gt;  uint8_t sin_len;&lt;br /&gt;  sa_family_t sin_family; //specify the socket family:AF_INET,AF_ROUTE,AF_UNIX&lt;br /&gt;  in_port_t sin_port;//specify the port(e.g. 80 for HTTP see the posts about ports)&lt;br /&gt;  struct in_addr sin_addr; //here should be the type of addresses allowed to connect the server&lt;br /&gt;                                                              //to allow all of them we will use INADDR_ANY&lt;br /&gt;  char sin_zero[8];&lt;br /&gt;};&lt;br /&gt;//and a structure used in tcp clients which is filled when function&lt;br /&gt;//gethostbyname is called&lt;br /&gt;struct hostent{    &lt;code&gt;&lt;span style="font-family:Georgia,serif;"&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;     c&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial;"&gt;har *h_name; //server name&lt;/span&gt;&lt;br /&gt; &lt;/code&gt;&lt;code style="font-family: arial;"&gt;char **h_aliases; //server aliases&lt;br /&gt;&lt;/code&gt;&lt;code style="font-family: arial;"&gt;int h_addrtype;&lt;br /&gt;&lt;/code&gt;&lt;code style="font-family: arial;"&gt;int h_length;&lt;br /&gt;&lt;/code&gt;&lt;code style="font-family: arial;"&gt;char **h_addr_list;//very important here are the ip addresses&lt;br /&gt;&lt;/code&gt;&lt;code style="font-family: arial;"&gt;char *h_addr;//the first ip address&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}; &lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-1538687741480308323?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/1538687741480308323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=1538687741480308323' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/1538687741480308323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/1538687741480308323'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/few-structs-that-we-will-use.html' title='A few structs that we will use'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-2376990759525029316</id><published>2008-01-13T07:55:00.000-08:00</published><updated>2008-01-13T08:06:02.160-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='udp'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='concurent'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><title type='text'>More about functions used in a server programming</title><content type='html'>here are the main functions that we will use:&lt;br /&gt;int socket(int domain, int type, int protocol);&lt;br /&gt;domain=AF_INET,AF_UNIX&lt;br /&gt;type=SOCK_STREAM(for tcp), SOCK_DGRAM(for udp),SOCK_RAW&lt;br /&gt;protocol=0(for transport-we work at a transport level)&lt;br /&gt;-this functions creates a socket&lt;br /&gt;-it returns the descriptor for it if success and different error codes for rest&lt;br /&gt;-types of errors:&lt;br /&gt;EMFILE - Too many open files&lt;br /&gt;ENFILE - Too many open files in system&lt;br /&gt;EACCES - Permission denied&lt;br /&gt;EPROTONOSUPPORT - Protocol family not supported&lt;br /&gt;ENOMEM - Not enough space&lt;br /&gt;ENOBUFFERS - No buffer space available&lt;br /&gt;EINVAL - Invalid argument&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int bind(int sockfd,struct sockaddr *myaddr,sizeof(myaddr));&lt;br /&gt;//this function associate an address to an existing socket&lt;br /&gt;&lt;br /&gt;int listen(int sockfd,int backlog)&lt;br /&gt;//opens the socket to listen and creates a queue of waiting clients of backlog size(usually 5, but in HTTP clients should be as high as possible)&lt;br /&gt;&lt;br /&gt;int accept(int sockfd,struct sockaddr *hostaddr,sizeof(hostaddr))&lt;br /&gt;//with this the server accepts a connection request&lt;br /&gt;&lt;br /&gt;//other functions:&lt;br /&gt;read(), write()  as used in tcp client&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-2376990759525029316?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/2376990759525029316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=2376990759525029316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2376990759525029316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2376990759525029316'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/more-about-functions-used-in-server.html' title='More about functions used in a server programming'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-2870342779354171244</id><published>2008-01-13T07:48:00.000-08:00</published><updated>2008-01-13T07:52:59.496-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='library'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='concurent'/><title type='text'>More network libraries</title><content type='html'>There will be a number of functions more for the tcp server(concurent).&lt;br /&gt;&lt;br /&gt;The libraries are:&lt;br /&gt;//this one is for the structs that we will use in order to make the server run.&lt;br /&gt;#include                        &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;//this one is for functions needed for a socket.&lt;br /&gt;#include                        &amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;&lt;br /&gt;and been on linux we will use bsd(berkley system distribution) api for network.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-2870342779354171244?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/2870342779354171244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=2870342779354171244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2870342779354171244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2870342779354171244'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/more-network-libraries.html' title='More network libraries'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-5318852894681933343</id><published>2008-01-13T07:23:00.000-08:00</published><updated>2008-01-13T07:41:51.022-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='udp'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='concurent'/><category scheme='http://www.blogger.com/atom/ns#' term='iterativ'/><title type='text'>Types of servers</title><content type='html'>Whether you use UDP or TCP, but take 2 types of servers:&lt;br /&gt;-iterative;&lt;br /&gt;-concurent.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The iterative server support more clients at a time, but is resolving one request at a time. The rest have to wait until their turn will come.&lt;br /&gt;Concurent servers work different: for every client they create on a server a new process/thread in which will treat the request(apache server start with 6 process and add more when new clients are connecting).&lt;br /&gt;&lt;br /&gt;The main difference between UDP and TCP servers is that the clients of a UDP server will connect to a port and put their request there, but the TCP clients will use a port just to connect to the server. Once connected they will communicate through the socket.&lt;br /&gt;&lt;br /&gt;We will write a tcp server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-5318852894681933343?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/5318852894681933343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=5318852894681933343' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/5318852894681933343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/5318852894681933343'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/type-of-servers.html' title='Types of servers'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-8083700146532075194</id><published>2008-01-07T05:31:00.000-08:00</published><updated>2008-01-14T02:44:33.564-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='port'/><title type='text'>About ports</title><content type='html'>If I did the  mistake I thought why not speak about ports.&lt;br /&gt;&lt;br /&gt;network port=logical connection place.&lt;br /&gt;Most of the network protocols got ports for client/server activity.&lt;br /&gt;For ports we have 1 byte allocated(unsigned int).&lt;br /&gt;That means the values are from 0..65536.&lt;br /&gt;But the first 1024 are reserved for services.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Most known:&lt;br /&gt;SNMP - port:161,162&lt;br /&gt;HTTP - port:80&lt;br /&gt;TrivialFTP - port:69&lt;br /&gt;BOOTP - ports:67,68&lt;br /&gt;DNS - port:53&lt;br /&gt;SSH - port:22&lt;br /&gt;TCP,SMTP - port:25&lt;br /&gt;TELNET - port:23&lt;br /&gt;FTP - port:20(date connection),21(control connection)&lt;br /&gt;&lt;br /&gt;Next Saturday when I will show how to write a tcp server I will use a port higher than 1024.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-8083700146532075194?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/8083700146532075194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=8083700146532075194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8083700146532075194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/8083700146532075194'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/about-ports.html' title='About ports'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-1086684278293715100</id><published>2008-01-07T05:14:00.000-08:00</published><updated>2008-01-13T07:41:33.661-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><title type='text'>Simple TCP Client</title><content type='html'>I realized I've made one small problem:&lt;br /&gt;at this line of code I've put 80 for HTTP, but I shouldn't. I should have put the port receive from command line.&lt;br /&gt;serv.sin_port=htons(80);&lt;br /&gt;&lt;br /&gt;//corected&lt;br /&gt;//I will use function atoi which will convert string argv[] to a number&lt;br /&gt;serv.sin_port=htons(atoi(argv[2]));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Simple TCP Client&lt;br /&gt;//put here the libraries from the post of 5 January 2008&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;netdb.h&gt;&lt;errno.h&gt;&lt;fcntl.h&gt;&lt;signal.h&gt;&lt;errno.h&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;&lt;fcntl.h&gt;&lt;signal.h&gt;extern int errno;&lt;br /&gt;int sk;//socket variable&lt;br /&gt;&lt;br /&gt;//we will use a handler to print to screen what we receive from the the server we've connected to&lt;br /&gt;void myhandler(int x){&lt;br /&gt;char buf2[1000];&lt;br /&gt;&lt;br /&gt;bzero(buf2,1000);&lt;br /&gt;while(read(sk,buf2,1000)&gt;0){&lt;br /&gt;  printf("%s\n",buf2);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main(int argc,char *argv[]){&lt;br /&gt;int i;&lt;br /&gt;struct hostent* st1;&lt;br /&gt;struct sockaddr_in serv;&lt;br /&gt;&lt;br /&gt;if(argc&lt;2){&gt;&lt;port&gt;");&lt;br /&gt;}&lt;br /&gt;else{&lt;br /&gt;  //we create a socket&lt;br /&gt;  //it's important to be SOCK_STREAM so we could write to server&lt;br /&gt;  //and receive dates&lt;br /&gt;  if((sk=socket(PF_INET,SOCK_STREAM,0))==-1){&lt;br /&gt;      perror("Err la sk:");&lt;br /&gt;      exit(1);&lt;br /&gt;  };&lt;br /&gt;  //with this function we will get in a structure the ips of server&lt;br /&gt;  st1=gethostbyname(argv[1]);&lt;br /&gt;  //we asociate our handler to SIGIO signal&lt;br /&gt;  //SIGIO is sent everytime a Input/Output operation is made&lt;br /&gt;  signal(SIGIO,myhandler);&lt;br /&gt;  //binary copy we will copy the first ip from the struct st1_h_addr_list&lt;br /&gt;  //and put it into our serv structure&lt;br /&gt;  bcopy(st1-&gt;h_addr_list[0],&amp;amp;(serv.sin_addr),st1-&gt;h_length);&lt;br /&gt;  serv.sin_family=AF_INET;&lt;br /&gt;  //HTTP port:80&lt;br /&gt;  //SSH port:22&lt;br /&gt;  //Telnet port:23&lt;br /&gt;  //we are interested in HTTP port&lt;br /&gt;  serv.sin_port=htons(atoi(argv[2]));&lt;br /&gt;&lt;br /&gt;  //we are connecting to the server&lt;br /&gt;  if((connect(sk,(struct sockaddr*)&amp;amp;serv,sizeof(serv)))==-1){&lt;br /&gt;      perror("Err la sk:");&lt;br /&gt;      exit(1);&lt;br /&gt;  }&lt;br /&gt;  else{&lt;br /&gt;          //this is the command to get the first page&lt;br /&gt;      //char buf[]="GET /index.html HTTP/1.0 \n\n";&lt;br /&gt;      char buf[200];&lt;br /&gt;&lt;br /&gt;      fcntl(sk,F_SETOWN,getpid());&lt;br /&gt;      fcntl(sk,F_SETFL,O_ASYNC);&lt;br /&gt;&lt;br /&gt;      while(1){&lt;br /&gt;          fgets(buf,200, stdin);&lt;br /&gt;          write(sk,buf,strlen(buf));&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;  //we have to close the socket&lt;br /&gt;  close(sk);&lt;br /&gt;}&lt;br /&gt;return 0;&lt;br /&gt;}&lt;/port&gt;&lt;/host&gt;&lt;/signal.h&gt;&lt;/fcntl.h&gt;&lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/errno.h&gt;&lt;/signal.h&gt;&lt;/fcntl.h&gt;&lt;/errno.h&gt;&lt;/netdb.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-1086684278293715100?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/1086684278293715100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=1086684278293715100' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/1086684278293715100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/1086684278293715100'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/simple-tcp-client.html' title='Simple TCP Client'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-932933642633677743</id><published>2008-01-05T10:35:00.001-08:00</published><updated>2008-01-05T10:36:24.035-08:00</updated><title type='text'>This is all for today</title><content type='html'>Maybe next saturday I will speak about&lt;br /&gt;TCP Server(on a high port).&lt;br /&gt;&lt;br /&gt;Paul.Wish you all a good weekend.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-932933642633677743?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/932933642633677743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=932933642633677743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/932933642633677743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/932933642633677743'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/this-is-all-for-today.html' title='This is all for today'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-7036309498728562364</id><published>2008-01-05T10:29:00.000-08:00</published><updated>2008-01-13T07:42:28.968-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><title type='text'>Different commands that can be posted into a socket to a http server</title><content type='html'>example used before was :&lt;br /&gt;GET /index.html HTTP/1.1&lt;br /&gt;&lt;br /&gt;GET file.html&lt;br /&gt;HTTP/1.1&lt;br /&gt;&lt;br /&gt;there are only 3 version of HTTP(from '89 till now)&lt;br /&gt;0.9 - does not support a lot of things(out of use)&lt;br /&gt;1.0 - one big problem was that everytime you would type something wrong in the opened channel it would closed the connection&lt;br /&gt;and you would have to reconnect(lot of time lost)&lt;br /&gt;1.1 - this is the best&lt;br /&gt;&lt;br /&gt;the rest of command you can find in RFC 2616.&lt;br /&gt;&lt;br /&gt;Paul.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-7036309498728562364?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/7036309498728562364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=7036309498728562364' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7036309498728562364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7036309498728562364'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/different-commands-that-can-be-posted.html' title='Different commands that can be posted into a socket to a http server'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-7156953139509654888</id><published>2008-01-05T10:16:00.000-08:00</published><updated>2008-01-05T10:27:52.745-08:00</updated><title type='text'>Here goes the compilations</title><content type='html'>//How to compile this program&lt;br /&gt;//if you have a linux under text type&lt;br /&gt;gcc cl.c -o cl&lt;br /&gt;//if cl.c is the name of you source code&lt;br /&gt;&lt;br /&gt;//then lunch&lt;br /&gt;./cl&lt;br /&gt;//and a message will apear&lt;br /&gt;cmd host port&lt;br /&gt;&lt;br /&gt;//then lunch with paramaters&lt;br /&gt;./cl www.google.com 80&lt;br /&gt;&lt;br /&gt;//it should give you the possibility to write something&lt;br /&gt;//if connected&lt;br /&gt;&lt;br /&gt;//type&lt;br /&gt;GET /index.html HTTP/1.1&lt;br /&gt;&lt;br /&gt;//and you should receive the www.google.com first page in html&lt;br /&gt;&lt;cmd&gt; &lt;server&gt;&lt;/server&gt;&lt;/cmd&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-7156953139509654888?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/7156953139509654888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=7156953139509654888' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7156953139509654888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/7156953139509654888'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/here-goes-compilations.html' title='Here goes the compilations'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-6088881693119135965</id><published>2008-01-05T10:05:00.000-08:00</published><updated>2008-01-17T07:15:24.406-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><title type='text'>Here goes the tcp client</title><content type='html'>#include                        &amp;lt;stdio.h&amp;gt; &lt;stdio.h&gt;&lt;br /&gt;#include &lt;/stdio.h&gt;&amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;#include &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;strings.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;#include &lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;string.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;#include &lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;netdb.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;#include &lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;errno.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;#include &lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;fcntl.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;#include &lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;signal.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;&lt;fcntl.h&gt;#include &lt;/fcntl.h&gt;&lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&amp;lt;errno.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;strings.h&gt;&lt;string.h&gt;&lt;errno.h&gt;&lt;fcntl.h&gt;&lt;signal.h&gt;extern int errno;&lt;br /&gt;int sk;//socket variable&lt;br /&gt;&lt;br /&gt;//we will use a handler to print to screen what we receive from the the server we've connected to&lt;br /&gt;void myhandler(int x){&lt;br /&gt;char buf2[1000];&lt;br /&gt;&lt;br /&gt;bzero(buf2,1000);&lt;br /&gt;while(read(sk,buf2,1000)&gt;0){&lt;br /&gt;    printf("%s\n",buf2);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main(int argc,char *argv[]){&lt;br /&gt;int i;&lt;br /&gt;struct hostent* st1;&lt;br /&gt;struct sockaddr_in serv;&lt;br /&gt;&lt;br /&gt;if(argc&lt;2){&gt; &lt;port&gt;");&lt;br /&gt;}&lt;br /&gt;else{&lt;br /&gt;    //we create a socket&lt;br /&gt;    //it's important to be SOCK_STREAM so we could write to server&lt;br /&gt;    //and receive dates&lt;br /&gt;    if((sk=socket(PF_INET,SOCK_STREAM,0))==-1){&lt;br /&gt;        perror("Err la sk:");&lt;br /&gt;        exit(1);&lt;br /&gt;    };&lt;br /&gt;    //with this function we will get in a structure the ips of server&lt;br /&gt;    st1=gethostbyname(argv[1]);&lt;br /&gt;    //we asociate our handler to SIGIO signal&lt;br /&gt;    //SIGIO is sent everytime a Input/Output operation is made&lt;br /&gt;    signal(SIGIO,myhandler);&lt;br /&gt;    //binary copy we will copy the first ip from the struct st1_h_addr_list&lt;br /&gt;    //and put it into our serv structure&lt;br /&gt;    bcopy(st1-&gt;h_addr_list[0],&amp;amp;(serv.sin_addr),st1-&gt;h_length);&lt;br /&gt;    serv.sin_family=AF_INET;&lt;br /&gt;    //HTTP port:80&lt;br /&gt;    //SSH port:22&lt;br /&gt;    //Telnet port:23&lt;br /&gt;    //we are interested in HTTP port&lt;br /&gt;    serv.sin_port=htons(80);&lt;br /&gt;&lt;br /&gt;    //we are connecting to the server&lt;br /&gt;    if((connect(sk,(struct sockaddr*)&amp;amp;serv,sizeof(serv)))==-1){&lt;br /&gt;        perror("Err la sk:");&lt;br /&gt;        exit(1);&lt;br /&gt;    }&lt;br /&gt;    else{&lt;br /&gt;            //this is the command to get the first page&lt;br /&gt;        //char buf[]="GET /index.html HTTP/1.0 \n\n";&lt;br /&gt;        char buf[200];&lt;br /&gt;&lt;br /&gt;        fcntl(sk,F_SETOWN,getpid());&lt;br /&gt;        fcntl(sk,F_SETFL,O_ASYNC);&lt;br /&gt;&lt;br /&gt;        while(1){&lt;br /&gt;            fgets(buf,200, stdin);&lt;br /&gt;            write(sk,buf,strlen(buf));&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    //we have to close the socket&lt;br /&gt;    close(sk);&lt;br /&gt;}&lt;br /&gt;return 0;&lt;br /&gt;}&lt;/port&gt;&lt;/signal.h&gt;&lt;/fcntl.h&gt;&lt;/errno.h&gt;&lt;/string.h&gt;&lt;/strings.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-6088881693119135965?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/6088881693119135965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=6088881693119135965' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6088881693119135965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/6088881693119135965'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/here-goes-tcp-client_05.html' title='Here goes the tcp client'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-2053237481939571872</id><published>2008-01-05T09:49:00.000-08:00</published><updated>2008-01-13T07:43:40.660-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>Here goes the functions</title><content type='html'>//stdio.h functions&lt;br /&gt;//reading variables&lt;br /&gt;scanf("format",&amp;amp;varb);&lt;br /&gt;format=&lt;br /&gt;"%c"-for char&lt;br /&gt;"%d"-for int&lt;br /&gt;"%f"-for float&lt;br /&gt;"%lf"-for double&lt;br /&gt;"%x"-for hexa&lt;br /&gt;//listing variables&lt;br /&gt;printf("format",varb);&lt;br /&gt;//creating a new process&lt;br /&gt;fork();&lt;br /&gt;//to get the process pid(Process Identifier)&lt;br /&gt;getpid();&lt;br /&gt;//to get the parent process pid(Process Identifier)&lt;br /&gt;getppid();&lt;br /&gt;&lt;br /&gt;//stdlib.h functions&lt;br /&gt;//terminating the program&lt;br /&gt;exit(errno);&lt;br /&gt;errno=&lt;br /&gt;0-OK&lt;br /&gt;&gt;1-Errors&lt;br /&gt;&lt;br /&gt;//strings.h functions&lt;br /&gt;//returns the numbers of chars in the char []&lt;br /&gt;strlen(char [])&lt;br /&gt;//copies char source in dest&lt;br /&gt;strcpy(char dest[],char source[])&lt;br /&gt;//compares char [] with char []&lt;br /&gt;//if equal returns 0&lt;br /&gt;strcmp(char [],char [])&lt;br /&gt;//concatenate char source to the end of dest&lt;br /&gt;strcat(char dest[],char source[])&lt;br /&gt;&lt;br /&gt;//errno.h functions&lt;br /&gt;//work like a printf, but prints the number of errno&lt;br /&gt;perror("Text");&lt;br /&gt;&lt;br /&gt;//signal.h functions&lt;br /&gt;//to asociate a function(handler) to a system handler&lt;br /&gt;signal(SIGXXX,functionname);&lt;br /&gt;//to send a signal&lt;br /&gt;kill(process,signal)&lt;br /&gt;//to put your computer to receive a signal&lt;br /&gt;pause();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-2053237481939571872?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/2053237481939571872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=2053237481939571872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2053237481939571872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/2053237481939571872'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/here-goes-functions.html' title='Here goes the functions'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-3508963860134250318</id><published>2008-01-05T09:31:00.001-08:00</published><updated>2008-01-13T07:43:22.166-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='library'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><title type='text'>Here goes the libraries for tcp client</title><content type='html'>&lt;pre style="font-family: arial;"&gt;&lt;/pre&gt;&lt;br /&gt;Libraries needed:&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;br /&gt;#include &lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&amp;lt;stdlib.h&amp;gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt; &lt;stdlib.h&gt;&lt;br /&gt;//I will write it in C using Linux API(it should be compiled in Linux - I use Debian - but it will work in other distribution of Linux also - I also compiled in Mandriva 2008).&lt;br /&gt;#include &lt;/stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&amp;lt;strings.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;//we will use some binary(they are in kernel - and they are fast) like bzero(*buffer,size of buffer)&lt;br /&gt;#include &lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&amp;lt;netdb.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;//needed for socket&lt;br /&gt;#include &lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&amp;lt;string.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;string.h&gt;//for functions like strlen&lt;br /&gt;#include &lt;/string.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&amp;lt;errno.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;string.h&gt;&lt;errno.h&gt;//we will use perror() function&lt;br /&gt;#include &lt;/errno.h&gt;&lt;/string.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&amp;lt;signal.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;string.h&gt;&lt;errno.h&gt;&lt;signal.h&gt;//we will use some function to treat some signals&lt;br /&gt;#include &lt;/signal.h&gt;&lt;/errno.h&gt;&lt;/string.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&amp;lt;fcntl.h&amp;gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdio.h\&gt;&lt;stdio.h&gt;&lt;stdlib.h&gt;&lt;stdlib.h&gt;&lt;strings.h&gt;&lt;netdb.h&gt;&lt;string.h&gt;&lt;errno.h&gt;&lt;signal.h&gt;&lt;fcntl.h&gt;//will use the fcntl function to make the read function async&lt;br /&gt;&lt;br /&gt;extern int errno;&lt;br /&gt;//variable declared in errno.h we will use it for reporting the errno number&lt;br /&gt;&lt;/fcntl.h&gt;&lt;/signal.h&gt;&lt;/errno.h&gt;&lt;/string.h&gt;&lt;/netdb.h&gt;&lt;/strings.h&gt;&lt;/stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/stdio.h\&gt;&lt;/stdio.h&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-3508963860134250318?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/3508963860134250318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=3508963860134250318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/3508963860134250318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/3508963860134250318'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/here-goes-tcp-client.html' title='Here goes the libraries for tcp client'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-5100952628036070098</id><published>2008-01-05T09:26:00.000-08:00</published><updated>2008-01-05T09:30:02.862-08:00</updated><title type='text'>Nu am scris de mult</title><content type='html'>Nici nu am avut intentia.&lt;br /&gt;&lt;br /&gt;Dar m-am gandit ca din moment ce sunt la Facultatea de informatica sa povestesc cate ceva despre lucrurile pe care le facem.&lt;br /&gt;&lt;br /&gt;Am sa abordez in luna ce urmeaza:&lt;br /&gt;-Scrierea unui client tcp rudimentar&lt;br /&gt;-Scrierea unui server de smtp&lt;br /&gt;-Compilarea bibliotecii NTL pentru cripto&lt;br /&gt;-Diferite functii din NTL ajutatoare pentru criptografie&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-5100952628036070098?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/5100952628036070098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=5100952628036070098' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/5100952628036070098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/5100952628036070098'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2008/01/nu-am-scris-de-mult.html' title='Nu am scris de mult'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-3120789784770129673</id><published>2007-08-17T05:48:00.000-07:00</published><updated>2007-08-17T05:51:13.778-07:00</updated><title type='text'>Cum arat dupa un an de facultate ?</title><content type='html'>Grea intrebare.&lt;br /&gt;&lt;br /&gt;La fiecare pas ai de facut alegeri. Alegeri care te maturizea-za. Te schimba. Iti dau aripi sau te arunca la pamant. Alegeri facut voit sau lasat in voi valului.&lt;br /&gt;&lt;br /&gt;Nu am nici o "bobita"(restanta pentru novici) si astept cu nerabdare anul II.&lt;br /&gt;Bursa: Nesperata sansa, care totusi am ratat-o la limita in sem. I, nu stiu pe sem. II.&lt;br /&gt;&lt;br /&gt;Dumnezeu sa aiba mila de mine!&lt;br /&gt;Al vostru,&lt;br /&gt;ex-boboc,&lt;br /&gt;Paul Guralivu&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-3120789784770129673?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/3120789784770129673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=3120789784770129673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/3120789784770129673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/3120789784770129673'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2007/08/cum-arat-dupa-un-de-facultate.html' title='Cum arat dupa un an de facultate ?'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-116307255727910276</id><published>2006-11-09T03:39:00.000-08:00</published><updated>2008-01-07T01:42:05.337-08:00</updated><title type='text'>Dupa 6 saptamani</title><content type='html'>Facultatea dupa 6 saptamani...&lt;br /&gt;sunt ingrijorat...&lt;br /&gt;am ramas in urma cu niste cursuri...&lt;br /&gt;am doar un absent la un seminarul de la matematica...&lt;br /&gt;&lt;br /&gt;dar mai important ca orice...a disparut acea "flame" cu privire la stiinta&lt;br /&gt;calculatoarelor...&lt;br /&gt;&lt;br /&gt;sunt putin deprimat...&lt;br /&gt;&lt;br /&gt;Dar imi iubesc meseria...&lt;br /&gt;&lt;br /&gt;Dumnezeu sa aiba mila de mine!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-116307255727910276?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/116307255727910276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=116307255727910276' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116307255727910276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116307255727910276'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2006/11/dupa-6-saptamani.html' title='Dupa 6 saptamani'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-116230256017960055</id><published>2006-10-31T05:46:00.000-08:00</published><updated>2006-10-31T05:49:20.190-08:00</updated><title type='text'>Off...</title><content type='html'>Vorba unui prieten..."Grea viata"&lt;br /&gt;&lt;br /&gt;Imi place facultatea, dar exista inconveniente...&lt;br /&gt;&lt;br /&gt;Ma gandesc uneori... ce o sa fac dupa facultate...am sa urmez un master... sau&lt;br /&gt;am sa am angajez in industria de dezvoltare si cercetare softeware...nu stiu...&lt;br /&gt;&lt;br /&gt;ce stiu e ca as vrea acuma sa lucrez pe diferite site-uri....&lt;br /&gt;Dar am teme ...am de invatat...stiinta este ceva ce atrage...&lt;br /&gt;&lt;br /&gt;apoi mai sunt si jocurile...si daca ma prinde mania jocurilor...greu scap...&lt;br /&gt;si scap, dar voi suporta consecintele...&lt;br /&gt;&lt;br /&gt;Dumnezeu cu mila!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-116230256017960055?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/116230256017960055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=116230256017960055' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116230256017960055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116230256017960055'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2006/10/off.html' title='Off...'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-116167372929121035</id><published>2006-10-24T00:07:00.000-07:00</published><updated>2006-10-24T00:08:49.296-07:00</updated><title type='text'>Dupa 3 saptamani</title><content type='html'>Ce pot sa zic...facultatea e faina...&lt;br /&gt;&lt;br /&gt;Algoritmi si programare e materia favorita....&lt;br /&gt;&lt;br /&gt;Abia astept cursurile viitoare...gen Programarea orientata obiect...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-116167372929121035?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/116167372929121035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=116167372929121035' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116167372929121035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116167372929121035'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2006/10/dupa-3-saptamani.html' title='Dupa 3 saptamani'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-116160865127042272</id><published>2006-10-23T06:02:00.000-07:00</published><updated>2006-10-23T06:04:11.280-07:00</updated><title type='text'>Sa ma prezint</title><content type='html'>Imi cer iertare...am uitat sa ma prezint&lt;br /&gt;&lt;br /&gt;Sunt Paul Guralivu,20, sunt student la facultatea de informatica...&lt;br /&gt;&lt;br /&gt;Tocmai am absolvit Colegiul Richard Wurmbrand Iasi...&lt;br /&gt;&lt;br /&gt;Am venit la informatica...pentru ca asta am vrut sa fac din clasa a 2a...&lt;br /&gt;atunci tatal meu mi-a pus in fata un calcultator....&lt;br /&gt;si a fost dragoste la prima vedere...&lt;br /&gt;de-a lungul timpului m-am orientat spre programare...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-116160865127042272?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/116160865127042272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=116160865127042272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116160865127042272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116160865127042272'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2006/10/sa-ma-prezint.html' title='Sa ma prezint'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-116090465441429589</id><published>2006-10-15T02:29:00.000-07:00</published><updated>2006-10-15T02:30:54.423-07:00</updated><title type='text'>Dupa 2 saptamani</title><content type='html'>Iubesc facultatea....&lt;br /&gt;&lt;br /&gt;M-am intalnit cu fostii mei colegi din liceu....&lt;br /&gt;fiecare a povestit cum a fost..ca prea a fost plictisitor....&lt;br /&gt;ca prea a fost infricosator...&lt;br /&gt;&lt;br /&gt;pentru mine:sunt in paradis....&lt;br /&gt;&lt;br /&gt;Paul Guralivu, facultatea de informatica....viata frate&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-116090465441429589?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/116090465441429589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=116090465441429589' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116090465441429589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116090465441429589'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2006/10/dupa-2-saptamani.html' title='Dupa 2 saptamani'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-35782687.post-116046483825037813</id><published>2006-10-10T00:16:00.000-07:00</published><updated>2006-10-10T00:20:38.263-07:00</updated><title type='text'>Prima saptamana la facultate-test drive-ul jucariei</title><content type='html'>Bine ati venit la "Jurnalul unui copilas despre jucaria lui"...&lt;br /&gt;&lt;br /&gt;Prima saptamana a fost cea mai interesanta...stiti voi...cunoasterea colegilor...&lt;br /&gt;a profesorilor...stiti voi....cum va numiti? de unde veniti? ai facut sau nu&lt;br /&gt;&lt;br /&gt;Si uzualele raspunsuri&lt;br /&gt;Ma numesc.... si Vin de la ....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/35782687-116046483825037813?l=programminginterests.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programminginterests.blogspot.com/feeds/116046483825037813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=35782687&amp;postID=116046483825037813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116046483825037813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/35782687/posts/default/116046483825037813'/><link rel='alternate' type='text/html' href='http://programminginterests.blogspot.com/2006/10/prima-saptamana-la-facultate-test.html' title='Prima saptamana la facultate-test drive-ul jucariei'/><author><name>Paul Guralivu</name><uri>http://www.blogger.com/profile/15861445995235921273</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp2.blogger.com/_asy2Ewsi3tU/SBg0JSUfQPI/AAAAAAAAAAM/asDmDbpjMFk/S220/AUTHOR_PHOTO20075301411241866.jpg'/></author><thr:total>0</thr:total></entry></feed>
