{"id":144,"date":"2010-06-25T17:21:19","date_gmt":"2010-06-25T18:21:19","guid":{"rendered":"http:\/\/www.tamats.com\/blog\/?p=144"},"modified":"2010-06-25T17:21:20","modified_gmt":"2010-06-25T18:21:20","slug":"my-simple-ip-socket-server-in-python","status":"publish","type":"post","link":"https:\/\/www.tamats.com\/blog\/?p=144","title":{"rendered":"My simple IP Socket Server in Python"},"content":{"rendered":"<p>This is a small python code I wrote to create easily apps that connect using a socket.<\/p>\n<p>The interface is really fast:<\/p>\n<blockquote><p>from easyserver import *<\/p>\n<p>def on_client(info):<br \/>\nprint &#8220;Alguien viene&#8230; &#8221;<br \/>\nprint info.details<\/p>\n<p>def on_message(info, msg):<br \/>\nprint &#8220;Dice: &#8221; + msg<\/p>\n<p>def on_close(info):<br \/>\nprint &#8220;Se fue&#8230;&#8221;<br \/>\nprint info.details<\/p>\n<p>EasyServer(20000,on_client, on_message, on_close)<\/p><\/blockquote>\n<p>This will call any of those callbacks anytime somebody connects to the server listening in port 20000. More simple is impossible.<\/p>\n<p>Here is the code: <a rel=\"attachment wp-att-145\" href=\"http:\/\/www.tamats.com\/blog\/2010\/06\/my-simple-ip-socket-server-in-python\/easyserver\/\">easyserver.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a small python code I wrote to create easily apps that connect using a socket. The interface is really fast: from easyserver import * def on_client(info): print &#8220;Alguien viene&#8230; &#8221; print info.details def on_message(info, msg): print &#8220;Dice: &#8221; + msg def on_close(info): print &#8220;Se fue&#8230;&#8221; print info.details EasyServer(20000,on_client, on_message, on_close) This will call [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,3,4],"tags":[],"class_list":["post-144","post","type-post","status-publish","format-standard","hentry","category-coding","category-devlog","category-python"],"_links":{"self":[{"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=144"}],"version-history":[{"count":2,"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/144\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tamats.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}