This document outlines a webinar on socket programming with Python, led by Achmad Mardiansyah from GLC Networks, covering topics such as Python networking, protocol analysis, and live practices. The presentation includes prerequisites, basic Python concepts, and socket programming fundamentals, along with a Q&A session. The attendees are encouraged to participate and provide feedback after the session.
www.glcnetworks.com
What is GLC?
●Garda Lintas Cakrawala (www.glcnetworks.com)
● Based in Bandung, Indonesia
● Areas: Training, IT Consulting
● Certified partner for: Mikrotik, Ubiquity, Linux foundation
● Product: GLC radius manager
● Regular event
4
5.
www.glcnetworks.com
Trainer Introduction
● Name:Achmad Mardiansyah
● Base: bandung, Indonesia
● Linux user since 1999, mikrotik user since 2007, UBNT
2011
● Mikrotik Certified Trainer
(MTCNA/RE/WE/UME/INE/TCE/IPv6)
● Mikrotik/Linux Certified Consultant
● Website contributor: achmadjournal.com, mikrotik.tips,
asysadmin.tips
● More info:
http://au.linkedin.com/in/achmadmardiansyah
5
6.
www.glcnetworks.com
Past experience
6
● 2021(Congo DRC, Malaysia): network support,
radius/billing integration
● 2020 (Congo DRC, Malaysia): IOT integration,
network automation
● 2019, Congo (DRC): build a wireless ISP from
ground-up
● 2018, Malaysia: network revamp, develop billing
solution and integration, setup dynamic routing
● 2017, Libya (north africa): remote wireless migration
for a new Wireless ISP
● 2016, United Kingdom: workshop for wireless ISP,
migrating a bridged to routed network
7.
www.glcnetworks.com
About GLC webinar?
●First webinar: january 1, 2010 (title:
tahun baru bersama solaris - new year
with solaris OS)
● As a sharing event with various topics:
linux, networking, wireless, database,
programming, etc
● Regular schedule
● Irregular schedule: as needed
● Checking schedule:
http://www.glcnetworks.com/schedule
● You are invited to be a presenter
○ No need to be an expert
○ This is a forum for sharing: knowledge,
experiences, information
7
www.glcnetworks.com
Basic stuffs
● Variable
●Command (keywords)
● Operation (+, -, *, /, %)
● Array (list, tuple, dictionary)
● Loop
○ For loop
○ While loop
11
x = "Python is "
y = "awesome"
z = x + y
print(z)
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
i = 1
while i < 6:
print(i)
i += 1
Source: www.w3schools.com
12.
www.glcnetworks.com
Procedural Python
● Codeexecuted sequentially
● Easy to understand
● Faster to implement
● Natural
● Program lines can be very long
● Need a way to architect to:
○ Manage our code physically
○ Manage our application logic
12
x = "Python is "
y = "awesome"
z = x + y
print(z)
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
Source: www.w3schools.com
13.
www.glcnetworks.com
Efficient code: usingfunctions
● A function is a block of code which
only runs when it is called.
● You can pass data, known as
parameters, into a function.
● A function can return data as a
result.
13
def my_function(fname, lname):
print(fname + " " + lname)
my_function("Emil", "Refsnes")
Source: www.w3schools.com
14.
www.glcnetworks.com
Efficient code: usingexternal functions (library)
● Consider a module to be the same
as a code library.
● A file containing a set of functions
you want to include in your
application.
14
vim mymodule.py
person1 = {
"name": "John",
"age": 36,
"country": "Norway"
}
vim myapp.py
import mymodule
a = mymodule.person1["age"]
print(a)
Source: www.w3schools.com
15.
www.glcnetworks.com
Exception
● Exception isa feature to handle
the an error so that it wont
displayed on foreground
● Use try … except
● Python built-in exception:
https://docs.python.org/3/library/ex
ceptions.html
●
15
vim file.py
try:
a=5
b=0
print (a/b)
except TypeError:
print('Unsupported operation')
except ZeroDivisionError:
print ('Division by zero not allowed')
print ('Out of try except blocks')
Source: www.w3schools.com
16.
www.glcnetworks.com
7 OSI layer& protocol
16
● OSI layer Is a conceptual model from ISO
(International Standard Organization) for project
OSI (Open System Interconnection)
● When you send a message with a courier, you
need to add more info to get your message arrived
at the destination (This process is called
encapsulation)
● What is protocol
○ Is a set of rules for communication
○ Available on each layer
● Communication consist of series encapsulation
○ SDU: service data unit (before PDU)
○ PDU: protocol data unit (after header is added)
www.glcnetworks.com
7 OSI layer& protocol
18
● OSI layer Is a conceptual model from ISO
(International Standard Organization) for project
OSI (Open System Interconnection)
● When you send a message with a courier, you
need to add more info to get your message arrived
at the destination (This process is called
encapsulation)
● What is protocol
○ Is a set of rules for communication
○ Available on each layer
● Communication consist of series encapsulation
○ SDU: service data unit (before PDU)
○ PDU: protocol data unit (after header is added)
www.glcnetworks.com
What is socket(networking)
● software/app need to be able to communicate to each other (IPC - inter
process communication)
● IPC method:
○ Pipe (e.g UNIX)
○ Semaphore (e.g. unix)
○ Socket (famous in networking)
● Socket method:
○ UNIX socket
○ STREAM socket (internet)
● STREAM socket:
○ Datalink
○ Internet (IPv4 / IPv6)
○ Transport (TCP / UDP)
26
27.
www.glcnetworks.com
What socket programmingcan do?
● Server app
● Multiplayer online games
● Chat application
● Data gathering
● Internet of Things (IOT)
● Create your own protocol / application
●
27
28.
www.glcnetworks.com
Python socket programming
●Module: socket, sys
● Server side
○ Setup ip address and port
○ Bind / listening on a port/ip address
● Client side
○ Connect to ip address / port
● Example code:
https://github.com/amardiansyah/python_socket_programming
●
28
www.glcnetworks.com
Interested? Just cometo our training...
● Topics are arranged in systematic and logical way
● You will learn from experienced teacher
● Not only learn the materials, but also sharing experiences, best-practices, and
networking
34
35.
www.glcnetworks.com
End of slides
●Thank you for your attention
● Please submit your feedback: http://bit.ly/glcfeedback
● Find our further event on our website : https://www.glcnetworks.com/en/
● Like our facebook page: https://www.facebook.com/glcnetworks
● Slide: https://www.slideshare.net/glcnetworks/
● Discord (bahasa indonesia): (https://discord.gg/6MZ3KUHHBX)
● Recording (youtube): https://www.youtube.com/c/GLCNetworks
● Stay tune with our schedule
● Any questions?
35