#networks

1 messages ¡ Page 39 of 1

still loom
#

"tag" does not support '-' operation

#

You can't do it with text

night perch
#

can I share any network information here?

#

well

#

I will assume so

#

If I can't I am willing to stop

#

I have a question and that is

#

Does anyone know how a pfsense work?

ember ledge
wind oriole
#

I started running mitmproxy (technically mitmweb) and a little 5-line Python script to basically archive my browsing history, but this thing is a real memory hog. I'm not loading any insane, huge sites or making tons of calls, but after about 20 minutes I have to shut it down to my cat doesn't get sucked through a computer fan.

#

Even crashed my macbook pro once because of memory issues

#

I really want to run this full time, has anyone else experienced this? And preferably solved it?

sharp adder
#

How can I get my backtesting software on a remote server to run instead of my local machine. Plz help

errant bayBOT
#

:incoming_envelope: :ok_hand: applied mute to @ember ledge until <t:1640092904:f> (9 minutes and 59 seconds) (reason: burst rule: sent 8 messages in 10s).

native saffron
#

can anyone guide me how to start learning sockets?

carmine wolf
#

youtube

narrow axle
heavy quarry
#

Hey pals!

#

I gotta question here

#

I was trying to scrape the response from this api

#

I finally did it with selemiumwire

#

but after all the hardwork of reasearching and trial and error

#

I discover that I had , in one of the thousand tabs that I have opened in my browser, the json response from that url

#

nubimetrics is a platform that requires username and password to login

heavy quarry
#

file

#

Now I'm trying to see how i managed to do it

#

If i click on refresh the api displays error again

#

but in the tab that is working this appears

#

with this commented : `Determine if an object is a Buffer
*

golden jolt
#

Okay so I'm using the apache benchmarking tool(ab) to test the concurrency of a reverse proxy(nginx) for a gunicorn+uvicorn server,

ab -n 100 -c 100 http://0.0.0.0:80/hello

I was binding gunicorn to a unix_socket because it's better for internal communication and there is no need for an inet socket(or thats what I understand)

$ gunicorn [options] -b unix:/path/

# nginx.config
upstream test {
    server unix:./serv1.sock;
}

however, when I run ab, the first request always blocks the others,
100 request -> wait for the 1st request then send concurrent 99 requests, I then out of curiosity bound gunicorn to localhost:8081 which surprisingly was faster, all 100 requests were concurrent, any idea why this is happening?

hoary horizon
wraith trout
#

hello guys

#

im new in packet tracer and im trying to set the ip root for this network

thorn stratus
wraith trout
#

@thorn stratus the ip route that the messege use to travel from a pc to another

thorn stratus
#

okay you just need to tell each router which networks are behind which interfaces

wraith trout
#

you see that the router only knows about the networks that he is attached to

#

you see i fixed the ip root between all the pc but the root from pc 0 to pc2

#

that i dont know how

thorn stratus
#

so for pc 0 to get to pc 2, router 1 and router 2 need to know how to get to the 192.168.3.0 network,

#

then, for the return traffic to get back, router 3 and router 2 need to know how to get to the 192.168.1.0 network

vocal rapids
#

!code

errant bayBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

vocal rapids
#

Use proper formatting.

steel spindle
#

You need to find a way to send ICMP packets.

ember mango
#

!code

errant bayBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

ember mango
#

!code print('hi')

ember ledge
#
  1. is it possible to run an authoritative DNS server + TOR hidden service on the same machine in the cloud and parse any DNS requests coming from the client side to the actual DNS resolver running on port 53, via hidden service address, not direct IP
  2. clients also don't have Tor client installed

i know tor doesn't support subdomains but i advanced in this a little which gave me hope, by using clear net to onion router such as https://onion.pet/ (not promo) i was able to send a normal request to https://hiddenservicestring.onion.pet which did forward the request from clearnet to onion and eventually to my VPS

#

but thats HTTP interaction to my HTTP server, how about DNS interactions to my DNS server over tor

#

is this possible

thorn stratus
#

yep that sounds accurate

#

sounds like it can't really be done in python

fathom plank
#

is there a way i can use my python socket over internet without paying anything

thorn stratus
#

yes, usually

#

you usually just need to configure port forwarding your router

#

you obviously will still be paying for the cost of your internet, electricity to run the computer, etc. but you probably were paying for those already

ember ledge
#

Why is G0/0 a root port instead of F0/1

thorn stratus
#

because the two gigabit ethernet connections have a lower cost than the single fast ethernet connection

ember ledge
#

@thorn stratus is this how it is?

#

And g0/0 was root port because of the 8 root path cost vs 19 of f0/1?

thorn stratus
#

Looks correct to me

jade hemlock
#

daemon: mifd[1793]: dpi_util_read_fd: fd = 13: truncated: buf = ================= Policy Link list ==================== Ver-1.244 # policies:7498, # patterns:17015 *** Matched List *** rule_id: 1160767, # hit: 4 rule_id: 1069737, # hit: 2 rule_id: 1068478, # hit: 2 rule_id: 1068479, # hit: 1 rule_id: 1160178, # hit: 4 rule_id: 1160685, # hit: 3 rule_id: 1068119, # hit: 1 rule_id: 1069032, # hit: 7 rule_id: 1061382, # hit: 1 rule_id: 1061294, # hit: 5 rule_id: 1061174, # hit: 1 rule_id: 1068265, # hit: 10 rule_id: 1065522, # hit: 1 rule_id: 1063170, # hit: 3 rule_id:

or

daemon: bulkdatad[1786]: bulkdata_platform_get_parameter_paths: map_insert failed

Can anyone tell me what this means? its a system log error that i get like daily through my router where for some reason my PC and only my PC spikes to 2000ping back to 20 over and over every second for like an hour and i have no idea how to fix it.
(using AT&t stock modem)

glad totem
#

dunno, like with any other debian server?

summer maple
#

hey there! I have dockerized django and local postgrtes, but django cant connect to my db. I have added extra_hosts string but i still cant connect to db from container

stoic crescent
#

Can someone tell me , where should I start with networking in python ? P.S. I know some basic like topology , etc so i don't need tutorial for this

heavy cloak
radiant vortex
#

Hi, is anyone familiar with the matlab "matplotlib" library?

#

I'm plotting graphs for wifi singal strngth

#

but I have an issue with the code

#

if anyone knows matlab, then I can send the code and issue

left garnet
#

Used matplotlib with numpy but it was some time ago ... lol matlab too

#

Post that question to Data Science and AI we are there lol

fathom plank
#

im trying it from the previous 3 months

thorn stratus
#

Well first off you need either a static ip address (preferred) or a dhcp reservation for whatever is hosting the server so that your local ip stays the same. Then you need to configure the port forwarding

#

which depends a lot on your interface, but you are basically just telling it what local ip to send traffic to when it sees traffic on a certain port

fathom plank
#

u talking abt this

red garden
#

Hi, running a simple http server gives me the refused connection error and this suggestion: Allow Chrome to access the network in your firewall or antivirus settings. If it is already listed as a program allowed to access the network, try removing it from the list and adding it again. Is this the only problem there might be? Also, do the http.server modules automatically stop listening at a port once there's a keyboard interrupt in the terminal? If not, how can I killall?

cyan herald
ember ledge
#

Give me a book about networking pleqse

fathom plank
#

it asks me internal and external port

#

and protocol

errant bayBOT
#

Hey @fathom plank!

It looks like you tried to attach file type(s) that we do not allow (.pdf). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

fathom plank
autumn elk
#

I have been looking for some good books to get into networking

sick ore
#

If i could manage to pipe the stdout of a subprocess to a socket. Would I manage to monitor the progress of that subprocess in realtime?

ember ledge
#

@sick ore

#

look into tail -f filename.txt

#

it will basically monitor filename.txt which i also assume could be a socket

#

and whenever new data is appended to this file, it will appear on the screen

#

so in one terminal try something like:
for i in $(seq 10); do echo hey > out.txt ; sleep 2; done

and while its running type this in another terminal:
tail -f out.txt

#

both have to be in the same directory ofc

sick ore
#

I'm working with a server client relationship though

#

not a localhost

ember ledge
#

so by "monitor"

#

you meant

sick ore
#

I still need to get that data to the client

ember ledge
#

programatically

#

not seeing the actual progress in bash output

sick ore
#

I have sanic doing a subprocess and want the output of that subprocess sent back to the client

ember ledge
#

so you want to pipe this output

#

into a socket?

#

is it a socket file or a remote connection?

sick ore
#

remote connection I want all that data delivered back to the client

#

Well i'm working locally now

#

but eventually remote

ember ledge
#

so you could do it from 2 places, from the terminal itself when starting the sanic server from command line

#

and also inside of the actual code you wrote for your server

#

for the latter, something like this can work, this should be above everything in your code, just play around with it

#
import sys, socket, time, io

s = socket.socket()
s.connect(("localhost", 4444)) # your remote server location goes here
original_stdout = sys.stdout

# overwriting the built in write method
class file(io.TextIOWrapper):
  def write(self, d, encoding=sys.getdefaultencoding()):
    s.send(d.encode())
    original_stdout.write(d)
    super().write(d)

sys.stdout = file(open("/dev/null", 'a').detach()) 

# Main code goes here


# preferably run this in the end too
sys.stdout.close()
s.close()
#

this will redirect stdout to both localhost:4444 and also regular output at once

#

this should suffice unless logging library or similar is used under the hood by sanic

exotic flame
ember ledge
#

@sick ore do you want the data to be both printed and also sent to a remote machine

#

or only sent to a remote machine

sick ore
#

although maybe printed would offer a redundancy as well

#

🤔

thorn stratus
#

it depends on your application

#

your protocol will also depend on this

exotic flame
#
import asyncio

from sanic import Request, Sanic

app = Sanic(__name__)


@app.get("/")
async def handler(request: Request):
    response = await request.respond()
    cmd = "for nvar in {1..10};do echo $nvar;sleep 1s;done;"
    proc = await asyncio.create_subprocess_shell(
        cmd,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )
    while True:
        line = await proc.stdout.readline()
        await response.send(line)
        if proc.stdout.at_eof():
            break


app.run(port=9999, debug=True)
#

Do you mean something like this?

inner flicker
#

Looking for advice on being able to parse out packet information from a rerouted packet. I want to be able to pull out things like ip address, header information, mac information, etc etc... Would sockets be the correct route for this or is there something easier?

prisma cobalt
earnest sinew
#

how do i send udp packets through the socket module with proxy?

autumn elk
fathom plank
#

i cant understand any of your words

thorn stratus
#

I don't have enough information to help you

fathom plank
#

ok

fathom plank
#

what information u need

ember ledge
#

hey im new in this Community im enrolling into Diploma in computer science i wanna know what should i major in and can u all show a path to teach me to like free website to do pythan

ember ledge
#

sanic my.app | nc 127.0.0.1 4444

prisma cobalt
#

urrr no

prisma cobalt
fathom plank
#

hi

prisma cobalt
#

@fathom plank i can help you with your port forwarding

#

ping me when your back

fathom plank
#

BACK @prisma cobalt

prisma cobalt
#

okay good

#

go to the screen that showed you the external, internal port options

#

which port are you trying to forward (if you dont know then tell me what your purpose/application is)

#

@fathom plank

fathom plank
prisma cobalt
#

okay the internal and external port should be 5050

#

the internal IP address should be your computers local IPv4 address

prisma cobalt
#

which you can find by running ipconfig in CMD

fathom plank
#

yeah yeah

#

its been months

#

and i remember it now

#

🥲

prisma cobalt
#

so you filled that out?

fathom plank
#

like this?

#

what should i set the protocol

#

@prisma cobalt ??

prisma cobalt
#

then add the rule

#

and your set

fathom plank
#

i mean like

#

?do i have to add just click on the plus button

prisma cobalt
#

yeah

prisma cobalt
fathom plank
#

ok

prisma cobalt
#

then clients should be able to connect through port 5050

fathom plank
#

i've tried the same thing u told me many time but it just dosent get connected

prisma cobalt
#

has the rule been added

fathom plank
#

ye

#

added and saved in the router's settings

prisma cobalt
#

then you should be able to connect, whats not working?

fathom plank
#

let me see do it once again and i'll send the error to you

#

btw

prisma cobalt
#

?

fathom plank
#

@prisma cobalt what should be the ip in my client when i am operating it on some other network

prisma cobalt
#

Your public ip address

fathom plank
#

how do i get that

prisma cobalt
#

Type into google “what’s my IP address”

fathom plank
#

ok

#

got that

prisma cobalt
#

That’s the ip your client should use

#

Does it connect?

fathom plank
#

nope

#

it connects when given the internal ip

#

but dosent when given the public ip

#

=/

prisma cobalt
#

Are you using port 5050?

fathom plank
#

yes

prisma cobalt
#

Show your code

fathom plank
#

import socket

HEADER = 64
PORT = 5050
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
SERVER = "127.0.0.1"
ADDR = (SERVER, PORT)

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(ADDR)

def send(msg):
message = msg.encode(FORMAT)
msg_length = len(message)
send_length = str(msg_length).encode(FORMAT)
send_length += b' ' * (HEADER - len(send_length))
client.send(send_length)
client.send(message)
print(client.recv(2048).decode(FORMAT))

while True:
msg = input()
if msg == DISCONNECT_MESSAGE:
break
send(msg)

prisma cobalt
#

The ip your using is wrong

fathom plank
#

put 127.0.0.1 for security purposes (u should understand)

prisma cobalt
#

Ah

#

Show your port forwarding rules page

fathom plank
#

ok

#

here u go

prisma cobalt
#

Are you sure that’s your local IP address there?

fathom plank
prisma cobalt
#

What’s your server code?

fathom plank
#

sending

#

import socket
import threading

HEADER = 64
PORT = 5050
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(ADDR)

def handle_client(conn, addr):
print(f"[NEW CONNECTION] {addr} connected.")

connected = True
while connected:
    msg_length = conn.recv(HEADER).decode(FORMAT)
    if msg_length:
        msg_length = int(msg_length)
        msg = conn.recv(msg_length).decode(FORMAT)
        if msg == DISCONNECT_MESSAGE:
            connected = False

        print(f"[{addr}] {msg}")
        conn.send("Msg received".encode(FORMAT))

conn.close()

def start():
server.listen()
print(f"[LISTENING] Server is listening on {SERVER}")
while True:
conn, addr = server.accept()
thread = threading.Thread(target=handle_client, args=(conn, addr))
thread.start()
print(f"[ACTIVE CONNECTIONS] {threading.activeCount() - 1}")

print("[STARTING] server is starting...")
start()

prisma cobalt
#

Replace your server variable with “0.0.0.0”

fathom plank
#

ok

#

done

#

let me try

#

got that

#

connected

#

ty so much

#

tysm

#

tysm

prisma cobalt
#

Np 😁

#

The ip “0.0.0.0” indicates it binds to all interfaces (to accept all connections) but the way you were doing it would have only allowed connections from your local network

fathom plank
#

oohh

#

noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

#

i forgot to remove 127.0.0.1 from client file and thats why it got connected

#

now it not connecting 😭

#

@prisma cobalt any other gusses why its not working?

steady horizon
#

What's the problem?

fathom plank
#

umm

#

i want my python chat program to run over internet without me paying anything

#

i pot forwarded it

#

*port

steady horizon
#

You have to use your own machine's public IP address then

#

Ah okay

fathom plank
#

dont mind but please read the above chats and you will underatnd whats going on

#

*understand

steady horizon
#

Your server can start at the address returned by socket.gethostbyname(socket.gethostname())

#

Your clients connect to the public IP address

prisma cobalt
prisma cobalt
#

It sounds stupid but sometime you have to manually save the port forwarding rule on your routers page, it’s caught me out before lol

prisma cobalt
#

Yes

steady horizon
#

Try giving a positive number in server.listen

fathom plank
#

okay...

steady horizon
#

What's the code of the clients?

steady horizon
#

Don't connect them to "127.0.0.1"

fathom plank
#

no i wrote 127.0.0.1 for not reavealing my actual public ip

steady horizon
#

Okay

fathom plank
steady horizon
#

Can you try this code in a local network and use 127.0.0.1 in order to see if it's the port forwarding?

prisma cobalt
#

They said that worked I think

steady horizon
fathom plank
#

ohhh

fathom plank
#

it works in a local network

steady horizon
#

Maybe talk with your router manufacturer about this

#

Unless you have a manual

fathom plank
#

with me

#

2 years in the past

#

there is one small ok button

#

and if u press that the setting get saved

steady horizon
#

Is it possible for you to send a censored screenshot

fathom plank
#

ive edited these settings a lot of times

#

see if somethings are wrong here

steady horizon
#

Ports

fathom plank
#

ok i gues

steady horizon
#

Change the protocol to TCP

fathom plank
#

ok

prisma cobalt
#

It shouldn’t matter

fathom plank
#

done

steady horizon
#

Does it work now?

fathom plank
#

let me see

#

n

#

o

#

i

#

t

errant bayBOT
#

:incoming_envelope: :ok_hand: applied mute to @fathom plank until <t:1640788481:f> (9 minutes and 58 seconds) (reason: burst rule: sent 8 messages in 10s).

prisma cobalt
#

😂

steady horizon
#

As you can no longer give feedback, try looking for a port forwarding tutorial online for your router type.

prisma cobalt
#

They say it doesn’t work

steady horizon
#

The tutorials' solution?

prisma cobalt
#

No, changing the protocol to tcp

#

As I said before it shouldn’t matter

steady horizon
#

And are they sure that they got the right IP address on the port forwarding rule?

#

I see they have sent a screenshot of an IPv4 address, and it seems as though they are on Windows, but is the address, then, prefixed with "Local IPv4 address:" or something like that?

sick ore
steady horizon
#

@fathom plank you should be able to type again now

fathom plank
#

ye

#

so

steady horizon
#

It's the server's IP address?

fathom plank
#

im running it on my local machine

steady horizon
#

Is that machine running the server script?

fathom plank
#

ye

steady horizon
#

You're probably doing something wrong port forwarding

fathom plank
#

umm

#

@steady horizon i am currently watching a tutorial and they said to include dmz and i cany get to figure out what should i put in host ip address

steady horizon
#

It can be one of three addresses. Your public IP address, your gateway (private) IP address or your server's (private) IP address

fathom plank
#

ok

junior leaf
#

can someone help whats wrong in this

fathom plank
junior leaf
#

wdym? i am new so idk

#

the error

steady horizon
#

try works like

try:
    # error prone code
except some exception:
    # handle exception
# or
finally:
    # do something
#

Both except and finally are optional but you need to have at least on of them

fathom plank
#

and how do you do that

steady horizon
#

!code @fathom plank

errant bayBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

steady horizon
#

They are highlighted because they are valid Python statement keywords

main summit
#

Does anyone know how long the expiration time of a dropbox api token is and how i get tokens that don't expire / break / whatever ?

runic elbow
#

How does aws Lambda talk to Ec2?
There is something I don't understand.

fathom plank
#

hi

#

ohh

mossy sluice
#

I have a little piece of Python code to grab some html from a forked repo on Github.com

headers = {    "Host": "github.com",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0",
"Cookie": "..." }

requests.get("https://github.com/007arunwilson/react-native-fs", headers=headers).text

I am passing in my cookie from my browser which seems to trick Github into thinking I'm logged in but every so often I get "Failed to load latest commit information."
Does anyone have any ideas why this is happening and how I can get around it? I've tried adding all the headers passed in through my browser but it still seems to do this randomly. Also tried adding some time.sleep.

ember egret
#

I have an amazing bot that can trigger your messages and send a message back.. the problem is when i do that the bot takes about 30 seconds to say the message back how can I fix this to normal time?

thorn stratus
# fathom plank im running it on my local machine

Port forwarding is for machines on the outside of your network trying to reach in, if you want it to work for going from inside your network to inside your network via the public IP, you would need to configure hairpin NAT, which not all routers support

#

I would instead recommend connecting using your local IP when inside your network and the public IP when outside your network

ember ledge
#

to IP:PORT pair

#

so for example, if you just run:

#

nc example.com 80
it will connect to the server behind example.com on port 80 and it will hang there and let you specify the payload you want to send

#

now if you pipe an output of a program into nc:
sanic hello.app | nc 127.0.0.1 80

#

it will run hello.app webserver and redirect output to 127.0.0.1

sick ore
#

it seems nc is for unix like hosts only though?

ember ledge
#

on port 80

sick ore
#

it doesn't work on win 10

ember ledge
sick ore
ember ledge
#

i believe there is netcat

#

on windows

#

sec

#

you can download it here

#

actually i am unsure about piping on windows

sick ore
#

not all the machines on this cluster will be windows but some of them will so looking to deploy it easily

ember ledge
#

i believe you can enable bash on windows

sick ore
#

which is why it would be great if I can just use regular python sockets and plug the client into it

ember ledge
#

which provides linux like terminal

#

basically

ember ledge
sick ore
#

yeah

#

and the less things to install the better

#

time is literally money when working with clusters

ember ledge
#

I am having issues with socket, I try to connect my second device (which is on the same network) and it work connect. I have a feeling this might have something to do with the firewall. However I am not sure how to resolve the issue.

fathom plank
fathom plank
ember ledge
#

you should have said right away that you were using windows @sick ore

#

and don't want every cluster to install additional things

#

besides python

sick ore
#

os shouldn't matter there are going to be some windows machines on the cluster

#

If I came here said I was building a distributed renderfarm nobody would answer

#

which is why I purposefully left it kinda general so I get everyones opinion

#

I never said I didn't want every machine on the cluster to have to install additional anything, less is better but its unreasonable to assume every machine I need to connect to has everything I'll worry about that when the time comes

ember ledge
#

in which case os would matter

#

@sick ore

#

will you be using powershell

#

for each of the clusters

sick ore
#

There was only going to be 1 cluster

#

Like 10 machines 224 cores each

ember ledge
#

will each of the machines

#

inside of a cluster

#

use powershell

sick ore
#

Its google compute cloud instances so no. They'll probably be ubuntu

I'd still want to use a platform independent solution if possible though

#

Because inevitably people are gonna be like "oh neat does it work on X"

zealous ridge
#

Lesson learned: don't use message queues of any sort to build RPC. There's much more corner cases to handle than if you would do it using plain TCP/HTTP. It's not that hard to find/write load balancers for TCP/HTTP. Most importantly, if for some reason you don't need the remote call anymore, you just close connection (most likely you need a timeout), and all proxies/balancers in the middle can easily propagate this intent.

mossy sluice
#

I tried using:

def text_from_url(url):
    cookiejar = browser_cookie3.firefox(domain_name='github.com')
    response = requests.get(url, cookies=cookiejar)
    return response.text

But doesn't even seem to work. At least if I copy/paste in my cookie from the browser headers it will be logged in

ember ledge
#

@sick ore holy shit

#

i just went down such a rabbit hole

#

out of curiosity

#

okay it is possible to do inside of python after all

#

!paste

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.

mossy sluice
#

I have a feeling that since Ubuntu moved to snap's Firefox's cookies.sqlite file has moved somewhere else

ember ledge
sick ore
#

Oo

#

thanks for your patience and help fren

#

I'll try that out and report back

mossy sluice
#

Anyway back to my original problem.. sometimes Github via requests.get() will give me a page with "Failed to load latest commit information." and it seems completely random

sick ore
#

where did you find this anyway

sick ore
#

Just wondering how you found it relatively quickly and I been bashing my head trying to find something

ember ledge
#

i have been bashing my head for maybe an hour

#

too

#

so basically

#

after pointlessly looking up ways to redirect stdout to a socket, something like sys.stdout = newval, which didn't work in this case, because instead of print() being used (in which case it would've worked) here the logging library was used by sanic to print out the output

#

i decided to take a look at the docs of sanic

#

and one of the parameters it takes when you initialize an app with app = Sanic() is logger config

#

it takes an object of this type logging.config.dictconfig so i tried to play around with it and eventually just gave up and looked up "logger into socket python"

#

on google

#

similar code to the one i posted was there

sick ore
#

ah

ember ledge
#

log_config is the name of the parameter

ember ledge
#

though @sick ore you should always look at the github issues

#

i found at least 6 questions there where people also had similar situations with sanic, which pointed me in the right direction

undone gust
#

i keep getting errors saying the address im using is already in use! i'm trying to create a socket and bind it to localhost/192.168.1.x/127.0.0.1 on port 8080, it keeps saying it's in use, i use fuser and lsof to see what process is using it, none. i still use fuser and lsof to kill all processes running on port 8080, even though they didnt list any, it still aint working, sayin it's in use!

#

im getting mad!

prisma cobalt
undone gust
#

aight..

#

the only ports i use when testing are 8080 and 6996

prisma cobalt
#

Do either of them with (when being bound to)

fierce dune
#

For sending data from an app, is just a normal is good, or should I create an api and use it to post?

ember ledge
ember ledge
prisma cobalt
unreal sail
#

Hi everyone. I have a technical issue! I developed Client Server Socket connection Python program. My app is Client and we have cpp server that developed on a board. (As a controller). This server will send a simple string to my client app. In my app will check this string into some procedures that i don’t need describe that here. But after getting string from the server, my program will send an ack from socket connection to cpp server. This ack is like s1 for opening door, and s2 for closing the door. This app worked (mean of worked is open/close door) on my mac and a simple windows system. our server is CentOS. My app is running on that. all procedures work very fine on that, even py app will send ack data base on the CentOS server. but door of traffic gate doesn’t open or close. Anyone have idea for this issue?

ember ledge
#

missping

#

meant to ping @undone gust

undone gust
#

nope im on linux

ember ledge
#

run

#

sudo netstat -tlpn

#

it will see which ports are in use by what programs

undone gust
#

any chance i can filter to only 8080?

#

ah nvm it only displayed 2 anyway

ember ledge
#

sudo netstat -tlpn | grep 8080

undone gust
#

nice thank you

ember ledge
#

so basically, say it says can't bind to port 8080, then with this command you can see what other program already uses and listens on that port

undone gust
#

i used fuser and lsof to do this, but, when trying on 8080, it said nothin was running

ember ledge
#

with lsof

#

sudo lsof -i :8080

undone gust
#

yeah thats what i did

ember ledge
#

does it print gibberish

undone gust
#

it prints nothin

#

well right now im not running my server but it still did nothing when it was running

ember ledge
#

just stick with

#

sudo netstat -tlpn

#

even without sorting by port

#

the output will be quite short

#

and you can easily distinguish which port is used by what program

undone gust
#

so when i first started using sockets a while ago, i noticed that if i closed my script the address/port would be occupied for a bit longer, so i googled it and some tutorial said to use

sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

and i've been doing so ever since, the docs are a bit MEH, can someone please explain what socket.setsockopt() does, what socket.SOL_SOCKET is, and what's the difference between socket.SO_REUSEADDR and socket.SO_REUSEPORT?

pearl solar
#

hi all, I would like to know if someone had the chance to work with GPON and Python. Thanks.

cold geyser
# undone gust so when i first started using sockets a while ago, i noticed that if i closed my...

those are socket options. the first argument is the level, and the second and third are the option "name" and option value to set. More can be read here: https://linux.die.net/man/3/setsockopt

undone gust
#

thank you ill read that

cold geyser
# undone gust thank you ill read that

that's the documentation for the C function setsockopt btw. it has the same signature, except the first argument int socket is skipped in your example, because you use it as a method of sock. So the int socket is implied. But basically: the python socket functions are just wrappers around the C versions with some extras.

#

I don't think the SO_REUSEADDR is actually needed on windows. It works quite differently there.

main summit
#

Hello, very specific question: I have a python code that sends a txt file to my dropbox using the dropbox api app i made, howver the token only lasts for 4hrs, how do i request a new OAuth2 token with app key and apps ecret as well as authorization_code? Does anyone maybe know ?
I've been trying to do this for 3 days now but always get some errors and wasn't able to find working code on github or stackoverflow

main summit
#

Problem solved.

snow nacelle
#

!warn 504167455359369216 Please don't dump advertisements here. We are not an adboard, as per our #rules.

errant bayBOT
#

:incoming_envelope: :ok_hand: applied warning to @dusky raptor.

steel spindle
latent socket
#

Is it normal to use one server for making a chat application?

mossy sluice
#

I need to get a list of forks for a Github project showing ahead and behind stats as well as last commit date. I've written a Python script and everything works great except for the date.

For some reason during operation it will randomly return a page with an error stating "Failed to load latest commit information." and I cannot retrieve the date from the page although ahead and behind stats are fine every time. I've tried adding time.sleep() with various delays but it doesn't seem to make a difference.

Here's the script:
https://pastebin.com/7m3t2kVG

Usage Example:
python3 list-forks.py https://github.com/itinance/react-native-fs

Does anyone have any ideas why this is happening and/or a potential work around?

thorn stratus
#

have you tried just retrying the request if you get that response?

mossy sluice
thorn stratus
#

Have you tried printing out the url it's failing on and seeing if you get the same response in a browser?

mossy sluice
thorn stratus
#

Sounds like either a bad url or a problem with github

#

Or maybe some type of rate limit?

mossy sluice
#

If I go to the website manually it works fine. If it's a rate limit it seems to happen very soon and even if I make it wait 10 seconds between each request it does the same thing

#

It's so weird.. I just added a 10 second wait between each request got this output:

https://github.com/itinance/react-native-fs (root)
https://github.com/007arunwilson/react-native-fs (-246 itinance:master)
https://github.com/1986webdeveloper/react-native-fs (-108 itinance:master)
https://github.com/2534290808/react-native-fs (-422 itinance:master)
https://github.com/386sx/react-native-fs (+1 -108 itinance:master)
https://github.com/3mpe/react-native-fs (-151 itinance:master)
https://github.com/4ian/react-native-fs (-654 itinance:master)
https://github.com/824420263/react-native-fs (-32 itinance:master)
https://github.com/a-koka/react-native-fs (-158 itinance:master)
https://github.com/abhilash0001/react-native-fs (-481 itinance:master)

Then changed back to 1 second then got this:

https://github.com/itinance/react-native-fs (root)
https://github.com/007arunwilson/react-native-fs (-246 itinance:master 2018-07-11)
https://github.com/1986webdeveloper/react-native-fs (-108 itinance:master 2019-07-26)
https://github.com/2534290808/react-native-fs (-422 itinance:master 2017-06-14)
https://github.com/386sx/react-native-fs (+1 -108 itinance:master 2019-09-13)
https://github.com/3mpe/react-native-fs (-151 itinance:master 2019-01-05)
https://github.com/4ian/react-native-fs (-654 itinance:master 2015-12-02)
https://github.com/824420263/react-native-fs (-32 itinance:master)
https://github.com/a-koka/react-native-fs (-158 itinance:master)
https://github.com/abhilash0001/react-native-fs (-481 itinance:master)
slender steeple
#

using the API >>> scraping

mossy sluice
slender steeple
blazing jewel
#

Port 80 is a reserved port. Only apps that are running as root can use it, generally speaking. If you change the port to anything over 1024 you should be good. By convention, people use port 8080 for running a webserver as a non-profit user

blazing jewel
sleek sand
#

thanks dude

blazing jewel
#

Np :)

ember ledge
#

Do you have to port forward in order to connect devices across different networks using socket?

prisma cobalt
#

Note: if your a client then it’s not needed, only the server has to

thorn stratus
#

port forwarding is only relevant if there is NAT at some point in between the two networks

ember ledge
#

hi i made a vpn and m trying to hook up attack nonfictions it made in python but it wont let me screen it

#

how do i run python on a vps server ?

ember ledge
#

Your vps server is not much different from your home computer

#

It’s just a computer in the cloud that’s running operating system the way your personal computer would

#

What OS is it using?

hardy jasper
#

hello all, anyone good with netmiko here ?

short void
#

server.py```python
host = 'local host'
port = 5000

s = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)

s.bind(('', port))

s.listen(100)

keepalive = True
connectedClients = []

def broadcast(message):
for x in connectedClients:
x.send(message)

while keepalive == True:
c, addr = s.accept()
if (c not in connectedClients):
connectedClients.append(c)
print("added user")
else:
print("didnt add user")

display client address

   print("CONNECTION FROM:", str(addr))

send message to the client after

encoding into binary string

   connData = list(addr)
   connIdentifier = str(connData[1])
   fullmessage = f"{connIdentifier} has joined the room."
   encodedmessage = fullmessage.encode()
   print(c)
   c.send(encodedmessage)
   
   threadedConns = []
   
   def loopedMessages():
          while True:
                 data = c.recv(1024).decode()
                 if (c not in threadedConns):
                        threading.Thread(target=loopedMessages, daemon=True).start()
                        threadedConns.append(c)
                        print("started thread for", c)
                 print(f"RECEIVED: {data}")
                 if not data:
                        break
                 broadcast(message=f"ADDTOCONSOLE {data}".encode())
   threading.Thread(target=loopedMessages, daemon=True).start()
If there's only 1 client sending messages to the server, it works fine. But when there's multiple clients sending messages to the server, the server doesn't receive any message in console after all clients send a message at least once.
Example: 
Client 1: 1
Client 2: 2
Client 1: 3
Client 2: 4
Only messages 1 and 2 would get sent.
Does anyone know what's the reason for this?
short void
# prisma cobalt whats your client script?
 global s
    s = socket.socket(socket.AF_INET,
                  socket.SOCK_STREAM)

    s.connect((f'{ip}', port))

    msg = s.recv(1024)

    connected = True
    while connected == True:
        while msg:
            print('Received:' + msg.decode())
            recMsg = msg.decode()
            splitRecMsg = recMsg.split(" ")
            if (splitRecMsg[0] == "ADDTOCONSOLE"):
                splitRecMsg.remove("ADDTOCONSOLE")
                recMsg = " ".join(splitRecMsg)
                currentConsoleContent = dpg.get_value(item="conn_console")
                newConsoleContent = f"""{currentConsoleContent}
{recMsg}"""
                dpg.set_value(item="conn_console", value=newConsoleContent)
                msg = s.recv(1024)
                continue
            sendMessage(sender=None, app_data=None, user_data=None, message=recMsg, author="SERVER")

            msg = s.recv(1024)
wheat hatch
#

So I want my raspberry pi to send data live to my desktop computer as fast as possible. How can I do this? Both devices are in the same house but out of Bluetooth range. I do have wifi at both devices location though

short void
wheat hatch
#

Alright thanks

neon kiln
#

hi

#

how can i connect with device use adb protocol ?

inner flicker
ember ledge
#

@wheat hatch if both computers are on the same local network then dont complicate things and just use socket library, your choice will be between TCP and UDP packets and considering what kind of data you are sending you might opt for UDP which is generally quicker

#

otherwise

#

which will remove extra latency on TCP and match its speed to UDP's

#

or close to that

#

but depends on what kind of data and how frequently is it being sent

wheat hatch
#

Very helpful, thank you

ember ledge
#

updated links*

short void
#

I would've waited but wanted to give some sort of help even if it may not have been useful as it's still better than nothing

ember ledge
#

VM + Cloud

#

these words themselves imply only adding more latency

#

when his task is just merely sending data from one computer on his home wifi to another

short void
#

The cloud isn't involved? it's self hosted

ember ledge
#

VM adds another layer at the very least

#

i just don't understand why complicate things

#

he should just write a simple solution first, make it as easy as possible and then dedicate his time to improving it

#

this will get him the best results

#

@wheat hatch generally you would want to pack data together into bigger chunks and send them

#

rather than many small individual chunks

short void
#

It is fair enough but as I said I was sending it as an alternative as it was better than nothing

ember ledge
#

okay, sorry for coming at you

#

if it seemed like it

short void
#

yeah it's fine, don't mention it lol

wheat hatch
ember ledge
#

besides many books and online resources you can find online or on reddit yourself

#

Here is two lectures i can personally recommend, which i used, while yes lectures are generally a longer approach than reading some quick sum up of the networking on some random website, at least it will be understandable. I actually wanted the material to be understandable and most importantly, rememberable. This instructor is exactly what i needed when i was starting out.

https://www.youtube.com/watch?v=kNKHM_isojI
https://www.youtube.com/watch?v=0Rb8AkTEASw

He has like 70 other networking lectures on his channel, while these 2 are the main ones, you can optionally also watch any other depending on your choosing, say you aren't too sure about how "ports" work or how "ip addresses" work then he has lectures dedicated to those

#

you can find many other courses online, there is tons of them with raw "theory"

#

once you understand (or better yet during the process of understanding) the way internet is roughly structured and at least a few core protocols that power the web

#

you should try actually writing some code related to networking

#

here is a good one for socket programming in C - http://beej.us/guide/bgnet/

you don't need to be a pro at C, the basics of that language are also explained as the author goes along throughout the material

wheat hatch
#

Got it, thanks for the help

fringe jay
#

How to setup a Hotspot/shared network by cmd? Ive tried so much, and still the virtual wireless networkadapter says: ipv4: No Internet
Ipv6:No Internet
Dont need an answer anymore

scenic glen
#

hey

spice cypress
#

how to create a secure chat room any suggestion ?

mossy sluice
fringe jay
prisma cobalt
#

Aww thanks man

scenic glen
livid edge
#

So, i have a minecraft server, and i made a python script to auto generate ip ranges of all non spanish talkers, im thinking to blacklist the IPs with IPSET, this could prevent bot attacks and pings? adding more protection to the server?, like prevent ICMP Flood, or bot attacks?
Also i only have spanish players

earnest raven
#

If you got the ip's, just load it in a firewall? What system are you on?

#

Does anyone have experience with grpc and envoy? Or other service discovery systems?

#

Looking to make a grpc microservice system, but haven't nailed down how the services are going to talk to each other. I'd like a central system for service registration and discovery, but haven't found much docs on it. So just wondering what's common setups

autumn frost
#

General question, not python related. I have two scripts using sockets to communicate. Server sends data, lets say with frequency of 100 fixed length msgs per second, client receives 1 msg per second. What happens when os socket buffer size is exceeded?

gloomy root
#

This is generally where the Idea of flow control comes in

#

in an ideal world, the server will stop sending packets until the client is ready to receive more data

#

in the case that the server doesnt behave

#

the OS will start discarding packets in most cases

autumn frost
#

Ok, so let's assume I have a case where most recent messages (that are not yet sent from server) are more important than those that are stuck in buffer - what should be correct thing to do in that situation? Decreasing or increasing system buffer size won't do much

#

Marking messages with some TTL flag would be ideal solution

frozen drum
#

the real solution is to rework your code so it doesn't throw 100 messages at a client that can only handle 1/100th of that.

cedar mural
autumn frost
#

Currently it is local Unix device, so probably neither one (not sure how socket implementation chosen protocol works in local envirnment over). But target solution would be over tcp

#

100 and much more messages per second is required, because it is realtime process that requires high frequency. Thus wondering id sockets approach is the correct choice. The most important thing, is that if for any reason client is behind with reading/receiving from the data source, more recent messages are more important that those that are delayed in the queue. So socket might not be good solution at all due to buffering.
Locally, shared memory would probably be a better choice

frozen drum
#

TCP is a stream protocol, so you can't "empty the send queue" of messages, because they can be arbitrarily split up.

#

Code on the client side has to take the stream and reassemble messages on their side, so if the concept of flushing existed, arbitrary parts of the stream would just go missing instead of specific messages. If you have a problem with a slow client, you can continually read from the socket to keep the read buffer empty (overwriting some state that contains the latest message)

#

if you do that, you have to secure access (read/write) to that state with a semaphore, so it's not overwritten as it's being read, at least if you do this concurrently.

autumn frost
#

Thanks for the insight. Just looking for the solution of the communication aspects, and sockets were the first thing that come to mind. It might not be the best choice after all.

If you have a problem with a slow client, continually read from the socket to keep the read buffer empty (overwriting some state that contains the latest message)
Forgive my ignorance - isn't the problem based on the fact that client, and thus reading, is slow? If it was possible to read fast enough, it would not be a problem in the first place. Right? Or am I missing something

#

Need to educate myself in using tcp with sockets, though

earnest blaze
# autumn frost Thanks for the insight. Just looking for the solution of the communication aspec...

Use headers, a header is basically meta data about the actual message.
You can have a fixed header size n and each time receive n bytes, decode it and get the length of the actual message.

This allows the server to send as fast as it wants. Since the client can now receive read the data at its own pace.

Read header, read message, read header, read message, read header....
Reading each one will let you know the size of the next, since the header indicates the size of the message, and after reading a message you can expect a fixed size header.
The socket's stream effectively becomes sorta a queue, loosely speaking.

If the server sends many headers and messages and the client doesn't start processing them immediately no problem!
All the data will be sitting neatly and organized waiting to be consumed and each effective packet * will effecitvely point* to the next:

header | msg | header | msg | header | >
read fixed size > read x size > expect fixed size> read x size > expect this size again....

And if you reach the end, you can just wait.

Depending on how large the payloads are, you will probably still want to compenstate for premature returns by recv since it only receives reads up to what its argument specifies.
Again TCP is a stream based protocol there isn't an underlying notion of seperate messages, it's all a homogenous clump of data, thus you can send the header and the payload bundled up, send them seperately, read them seperately or whatever, unless you've got reason not to.
But with how you strucutre your program and the rules you define, you can basically overcome the drawbacks of a stream, while still reaping the benefits! Namely, in order delivery.

earnest blaze
#

I know what I said doesn't solve your problem, but I hope it opens new doors, well because the below wouldn't work if you didn't implement something similar already.
You ultimately can't fully escape buffering, even in RTC protocols. After all TCP even if partially, is the base for many things.
With that said, I can think of two solutions, maybe. Use a different socket for urgent events, or as you suggested a TTL flag.

#

You could also do with some fine grained control over the sockets but the python wrapper doesn't offer a whole lot (I think?) and there are difference between linux and winodws. Anyway here's this for linux, perhaps it helps
https://linux.die.net/man/7/socket

strong shadow
#

i wanna find the urls of outgoing requests from my pc

#

https

#

how do i do it via python

ember ledge
#

so https traffic is encrypted, unlike http

#

so say you wanted to see what kind of url did your chrome browser just request (if https was used), if you were to try and use external program to "sniff" on the outgoing traffic, all you would see is gibberish

#

from which you can't make out the URL that was requested as its part of the encrypted data

#

so what you could do is to run a proxy server on your machine, then specify in chrome (for example) under the settings to forward all traffic through that proxy

#

and that proxy will be able to see the traffic, even if its HTTPS

look into burpsuite, it acts as a proxy and allows you to view and even modify HTTP/HTTPS traffic, but once again you will have to tweak the settings for pretty much every application (like chrome) that you want to intercept the traffic of

autumn frost
# earnest blaze You could also do with some fine grained control over the sockets but the python...

Thanks a lot for your comprehensive reply. It gave me a better overview on the problem. As for the reading header and then message, I think in my situation I can safely assume that messages will be fixed size (and if they are not, just pad them to the fixed size). At least for now until I need to handle different kind of messages.

If the server sends many headers and messages and the client doesn't start processing them immediately no problem!
All the data will be sitting neatly and organized waiting to be consumed
This is kind of edge case scenario that I want to analyze before I start working - maybe it is not a problem at all and I am overanalyzing. Assuming that it takes n time for data source to send data, and m for client to read data but g time to process that data, where n < g + m, does it mean the buffer will be gradually increasing in size and thus being unstable, approaching max buffer size? At that point it will make sense to read all the data from the buffer and just discard all messages that match some criteria (like expired message)

Let me know if above scenario is valid at all and not some absurdity, because maybe I don't understand this subject enough and I am making up some impossible situations

autumn frost
#

Probably sockets are just wrong tool for my usage and I should be using some kind of broadcast communication that emits single message (no queue/buffer)

patent swift
#

hi. i currently making a parental control in python and i wanted to add as one of the features blocking use time of computer. Do anyone knows how to block use of computer using python? Thanks

prisma cobalt
coarse canyon
#

are smaller packets less likely to be dropped?

earnest blaze
# autumn frost Thanks a lot for your comprehensive reply. It gave me a better overview on the p...

In essence, yes.

TCP employs a sliding window protocol for flow control purposes.
The gist of it is, the receiver will tell the sender how much data it is willing to buffer, the winodw size.

The sender will then be allowed to send up to that amount, and will have to wait to receive an acknowledgement back before it can send more data, and that too will contain a new, potentially different window size.
Basically, the receiver controls the flow of transmission.

(This doesn't rid you of the responsibility of coming up with your own set of rules to regulate the communication between the client and server, reliable delivery is not reliable reading)

This also ties into why send buffers are a thing, if the send buffer is full, further sends are put on hold and will block.
It's waiting for an ack, and when it receives it, the buffer will be emptied, sent and refilled.
But ofc normally sending shouldn't won't block.
(I think the effective maximum window / buffer size for TCP is 64 kilobytes since it's represented by 16 bits and because if you have an empty buffer, the window size will of course be the full buffer.
Idk what the default size actually is, but it can be changed with SO_RCVBUF)

At that point it will make sense to read all the data from the buffer and just discard all messages that match some criteria (like expired message)

So the problem wasn't reading the data in of itself after all?

Probably sockets are just wrong tool for my usage and I should be using some kind of broadcast communication that emits single message (no queue/buffer)

Sockets are sockets, there are many flavors of them, namely (datagram) UDP and (reliable stream) TCP.
I think UDP could be a candiate instead, it has this "fire and forget" philosophy, if the receival buffer is full, it'll drop addtional incoming packets instead of holding the sender hostage, it won't try to retransmit lost data, so less latency, therefore more real-time.

#

Also consider looking, into higher level streaming protocols such as RTP.

earnest blaze
autumn frost
sweet dragon
#

when you send data via ethernet cable is it always a byte stream?

frozen drum
#

thanks to the osi model you never have to care how the physical medium works.

earnest blaze
#

What data?

fossil pollen
#

Can anyone help with exchange codes?

ember ledge
#

If anyone knows how I would go about setting up an smtp server in python pls dm me

thorn stratus
karmic flume
#

why can't i do this request?:

    requests.post(url, allow_redirects=False, data={
        "l" : username,
        "p" : password
    })
#

nvm

solemn mist
#

how to determine the buff_size for recv when reading the client message ?

earnest blaze
solemn mist
earnest blaze
#

a fixed size message like "5 " or "15 ".
You can always receive the expected n bytes, then extract the length of the actual message from it

#

Of course there are cleaner ways to compact bytes but that's the gist of it.

thorn stratus
fleet flume
#

this just gives me a syntax error. what am i doing wrong? ```py

r = requests.post(config["sync_check_url"], data = data)
except requests.ConnectionError:
    await ctx.send("@fleet flume,@glad hill, Auth server is down. Please try again later.")```
ember ledge
thorn stratus
#

okay so you don't want to build it from scratch, you want to build off an existing implementation and add custom functionality?

#

and I would take the error at face value

#

use aiosmtp

analog heart
#

Challenge Question
Ike uses requests to get information from the internet. He needs to request from multiple links. How do you change the code to request from multiple links.


r = requests.get(f'https://discord.com/api/v9/channels/{Channel ID}/messages', headers=headers)

jsonn = json.loads(r.text)

for value in jsonn: 
    print(value['author']['username'], value['content'])
#

I wanted to do something like

Channel_ID = 05913280, 0193587124, 09148534, 318493805
#

or

#
Channel_ID[[0183294],[1029492],[1209453],[1230498]]
fading atlas
#

Hi all,
I'm using:

the writer from - asyncio.start_server(...)
   writer.write(message)

I'm sending data to a java application
The message is of format starts with the number of bytes the message is and then the rest of the message
Is there a limit to the message size write can send before it sends an EOF?

sturdy scarab
#

What is the fastest way to send a file on a local network?

#

I mean network protocol.

fading atlas
tame prairie
#

hey, ive tried making a client and a server on two different computers on the same network, but when i try to connect to the server through the client i get a
"[WinError 10061] No connection could be made because the target machine actively refused it"
and i am not sure how to fix it

#

any ideas where to start?

ember ledge
#

which protocol are you using to connect ? A port needs to be open on the server to allow the incoming connection

tame prairie
#

this is the socket i use: self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

ember ledge
#

AF_INET just means ipv4, so it doesn't say the port number yet

tame prairie
#

i bind them

#

self.s.bind((self.IPV4, self.PORT))

#

for the server

#

for the client i dont bind it

#

do i need to bind the client?

ember ledge
#

ok, but what is PORT ? RDP for example uses 3389

tame prairie
#

65432

ember ledge
#

now we're getting somewhere 😄 does the server accept incoming connections on port 65432 ?

tame prairie
#

yes

#

both client and server use it

ember ledge
#

did you set it in the firewall settings ?

tame prairie
#

i just allowed it to use the private network

#

do i need to open a port on my firewall

#

?

ember ledge
#

yes

tame prairie
#

hmmm

ember ledge
#

most ports are closed by default

tame prairie
#

is there no way to automatically do it

ember ledge
#

does that sound safe to you ?

tame prairie
#

no...

ember ledge
#

exactly hihi

tame prairie
#

then how do games do that?

ember ledge
#

some games require you to open a port when installing for example

tame prairie
#

so if i want to make a game that connects to another computer i need to open a port for it to work?

ember ledge
tame prairie
#

Its a simple game

#

I was gonna make someone who wants to start a game holds the server

#

If i make a server on the cloud will it solve the port problen

#

Problem*

tame prairie
ember ledge
ember ledge
tame prairie
#

So do i have by default open ports i can use?

ember ledge
#

I don't know, you can see that in the firewall 😉

tame prairie
#

So is this a dead end for my over wifi game?

#

Without people opening ports themselves?

ember ledge
#

I think you're confusing client & server now, the client wants to connect to the server
So the server is the one who needs to have a port open for incoming traffic

#

outgoing (on the client) is often already open

tame prairie
#

Okay but it still means anyone who wants to host a game has to open a port

tame prairie
#

Thank you for all your help Ewout

ember ledge
#

no problem !

tame prairie
#

But for the client to receive information from the server it needs an open port right?

tame prairie
#

@ember ledge

ember ledge
#

that part I'm not too sure about, I think it depends on the context

#

maybe there's a tutorial you can follow on the topic to make sure you're not missing anything ?

tame prairie
#

Ill search

tame prairie
tame prairie
#

does it matter if i bind my server to my IPV4 or to "0.0.0.0" ?

deft ocean
#

Hello, I've written python/selenium bot and i want to run this code on some server. Do you know and recommend any?

calm kestrel
#

i mean

#

what are you trying to do

#

Im always gonna use AWS cloud for web scraping

deft ocean
#

My bot is checking if product is available on page

tame prairie
#

when i want to make a server socket, do i need to bind it to my ipv4 or do i need to bind it to "0.0.0.0"? whats the difference?

autumn elk
#

IDK if it's the correct place to ask but how do you actually find an IP and establish a bridge connection

#

I am sorry but I am really new to this

#

I have been trying to use the phue module but it needs the IP of the bulb but I want the code to fetch the IP on itself instead of getting it from user

simple olive
#

can we hack without sending payloads

livid matrix
#

Can someone explain bit and bit rate to me like im 10 years old

tame prairie
#

i dont know about bitrate, but a bit is single 0/1 storage representing data, 8 bits are a byte

red dove
#

how do i simplify that like i mean how to not use \

earnest blaze
red dove
#

im stupid

#

how do i send json with websocket without json dumps

earnest blaze
red dove
#

i plan

#

well im trying to connect to discord gateway

#

oh wait

#

that was just indentation error

#

STUPID INDENTATION

#

is the bot supposed to be online after identifying ?

red dove
#

man why does no one disquses

drowsy raft
#

i don't understand a thing, if you are using TLS on your TCP connection then TCP SYN is still sent or it just sends TLS hello? pithink

dire elm
#

Is this a good place for API questions?

ember ledge
dire elm
covert bridge
#

Hello, does anyone know where I can find a demo of a small python project that walks you through CI/CD through Gitlab? I cannot find one for the life of me.

solemn mist
#

following code is executed in infinite loop (server socket code)
while True:
msg = client_socket.recv(1024).decode()
fmt_msg = f"msg received: {msg}"
print(fmt_msg)

when Ctrl+C performed on client socket. how to handle the KeyboardInterrupt on server side ? any suggestions

ember ledge
#

server side won't even know there was a KeyboardInterrupt on client side

#

so on server side, most likely a call for recv() or send() will raise some exception

#

because server will be trying to read from or write to the socket connection, but a socket connection doesn't exist anymore (since the client has terminated the program)

strong reef
#

How can i proxy my program for my bot discord???

lunar veldt
#

Hi guys

quiet hemlock
#

yo

empty folio
#

Does anyone here happen to know a thing about 'WAN Optimization'?

placid kayak
#

@thorn stratus We have that URL filtered out since it typically comes off as kind of rude

thorn stratus
#

better check your filter then

iron fjord
#

is TOR restricted to just HTTP or can it be any protocol?

ember ledge
#

can someone help me out and explain to me why they acls are placed as outbound?

ember ledge
#

both acl 10 and acl 30

stiff mirage
#

for acl 30: It looks as if it was set in such a way that it blocks access from 192.168.30.0/24 to the 192.168.31.0/24 subnet, but instead of doing that on g0/0, it's doing it on g0/1. Which I think is wrong. If I'm interpreting it correctly.

ember ledge
#

yea i thought the same thats why im confused

stiff mirage
#

yeah, it's a little bit confusing. You obviously want to catch the packets as fast as possible and don't want to waste time processing them before you drop them.

#

so as a general rule: block the packets on the interface the packets initially go in.

ember ledge
#

acl inbound is for packets that are sent from inside the network right?

stiff mirage
#

for acl 10 it might make sense thought

#

let me check, I haven't used cisco routers for a very long time

#

ok, so it's quite clear:

When you apply an ACL "in", the router examines all traffic it RECEIVES on the interface against the ACL.
When you apply an ACL "out" on an interface the router examines any traffic attempting to leave that interface against the ACL.

#

so IN means - receiving, some the packets that are arriving. OUT means leaving.

ember ledge
#

alright thanks

stiff mirage
#

so for ACL 10, as I said, it actually makes sense at first sight, if you consider what's being permited. If you were to apply the ACL on S0/1, then the packets might end up on the wrong interface, like g0/1

#

This has been a very productive python topic, in any case.

ember ledge
#

@stiff mirage yo i just noticed something

#

shouldnt access list 30 be placed at S0/1 as outbound?

#

since i want to deny from 192.168.30.128-192.168.30.254 access to other networks other than 192.168.31.0

#

but if i place it at G0/1 i deny that ip range to that network

stiff mirage
#

in the ACL 30

#

In any case, if 192.168.10.0/24 shouldn't be able to access 192.168.30.0/24 and only that, then it makes sense to place the ACL on G0/0. If you placed it on S0/1, then they're also not going to have access to 192.168.31.0/24, and you wouldn't want that.

stiff mirage
#

so in this respect, g0/0 - outbound I suppose makes sense

ember ledge
#

The out is correct

#

The port is wrong

stiff mirage
#

what port? You mean interface?

ember ledge
#

Yh

stiff mirage
#

(port can be a little bit misleading here, because you can refer to tcp/udp ports - although we're talking only about L3, so much is true 🙂 )

ember ledge
#

S0/1 is the correct one

stiff mirage
ember ledge
#

Same commands just change interface

#

Cuz

#

Or am i thinking this the wrong way 🤔

#

@stiff mirage it kinda makes sense because they are denying that ip range access to the dns network when they are suppossed to make it so its the only network they can access(possibly they accidently picked the wrong port since the command doesnt make sense if g0/1 is the correct port,while it would make sense if S0/1 is the correct port), if i place it on the s0/1 they wont be able to make it out to R2 but they will be able to access the dns network, right?

normal mango
#

Hellllo!

#

Maybe I'll make use from this forum for the first time...

#

I need a little help with login into a web page with Scrapy

#

Anyone?

#

it's working well with requests but not at all with scrapy Request

errant bayBOT
#

Hey @normal mango!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

normal mango
#

request = Request(
url=url,
method='POST',
dont_filter=True,
cookies=cookies,
headers=headers,
body=body,
)

stiff mirage
#

if you did that, then you'd match only the traffic come from g0/0 or g0/1 and going out on s0/1. But if you're looking to block access from 192.168.10.0/24, which first hits (so inbound) s0/1, that doesn't make much sense. You don't want to block return traffic, you want to block traffic as soon as possible (without disturbing anything else)

ember ledge
#

i would accomplish that by putting it on s0/1 output wouldnt i?

#

wait let me make a sketch rq

#

acc lets focus this

#

so its easier to explain

#

i want half the ips from 128 to 254 of 192.168.30.0 to be able to access only 192.168.31.0

stiff mirage
ember ledge
#

while the rest can access any, even r2 etc

#

bruh lol

#

you are on the wrong question

stiff mirage
#

ok, so we're talking about b) only?

ember ledge
#

yea

stiff mirage
#

Ok, now I understand the splitting of the subnet. I didn't know where that came from 🙂

ember ledge
#

ah its ok

#

it makes more sense tho right?

#

that they got the wrong port

#

because if it was placed on s0/1

#

the commands would be perfect, in my mind atleast

stiff mirage
#

so 192.168.30.128 to .254 need to acces only to 192.168.31.0/24, right?

ember ledge
#

yea

#

while the rest

#

0-127

#

can access both the dns

#

and otuside

#

outside

stiff mirage
#

Right, so no restriction.

ember ledge
#

yea

#

so it would make sense

#

to deny the 128-254 to access r2

#

that would be accomplished by denying it on s0/1 outbound

stiff mirage
#

Ok, so... everything looks correct actually now :))

ember ledge
#

what im saying is correct?

#

or the "answers" they gave

stiff mirage
#

I think you're actually right.

#

If you apply the ACL on G0/1 only, it means that .128-.254 can access any other network.

ember ledge
#

yea

#

the commands seem right if it was placed on s0/1

#

makes no sense on g0/1

#

they are doing the complete opposite of what they wanted lol

stiff mirage
#

and indeed, s0/1 outbound.

ember ledge
#

alright thanks for the help

stiff mirage
#

This works, because there aren't any other networks.

#

If R3 had yet another subnet connected to another interface of its, then applying the ACL on S0/1 wouldn't work, because .128-.254 would have access to that to. But this works, because there's no other network there than 192.168.31.0/24

ember ledge
#

yh

stiff mirage
#

Where do you have the solution from?

#

Is this official or what?

ember ledge
#

midterm exams for high school seniors lol

#

right from the ministry of education

#

the finest education 👌

#

yea the solutions are from them

stiff mirage
#

I would take that up with your teacher

#

if I were you

#

I would be curious to see what he says. Maybe there's something we're missing.

ember ledge
#

i dont think so

stiff mirage
#

But it definitely seems a mistake.

ember ledge
#

instructions are pretty clear tbh

stiff mirage
#

yeah

ember ledge
#

what they did doesnt match with the instruction whatsoever

stiff mirage
#

But it would be nice to see what they answer 🙂

ember ledge
#

i messaged my teacher and he wont even answer lol i doubt they would answer

stiff mirage
#

It's nice that you're doing this in high school. I only started it late during faculty when I took up CCNA.

ember ledge
#

we are doing ccna

#

but

stiff mirage
ember ledge
#

well its too late anyway the exam is in 4 days lol nobody is going to check on the solutions etc

#

ight i have a math lesson, thanks for your help

stiff mirage
#

Yeah, but it's worth understanding it afterwards too, just to make sure you're understanding it correctly.

#

you're welcome 🙂

weary kraken
#

hi

#

i have a question please

#

svp j'ai une question

#

esce possible d'enregistrer un objet dans une table de ma base de donnĂŠes sqlite?? si oui quelle sera le type Ă  mettre lorsque je crĂŠe la table ???

night maple
#

Hey guys, How do I start a TCP server on global IP and not on local IP?

real agate
#

Why does cisco dictate that your switch IP be one less than the router’s IP?

#

and why does cisco prefer you to statically assign an IP that is on the further end of an IP range

#

rather than the start

random trout
#

Hi! Quick question... would it be too taxing on the network and device to send curl requests every .5 sec when trying to monitor for changes? What would be a best practise when http requests is the only way to interact with the hardware?

placid fractal
random trout
#

a constant connection is more efficient than repeatedly polling through http requests just to check for changes in the xml output, hey?

empty folio
ember ledge
#

almost every country has that?

mortal gyro
#

Lol

#

laul

real agate
#

what the fuck is an internet port lmao

crystal current
placid fractal
empty folio
earnest blaze
frigid wind
#

Hey !
I'm trying to write a script for port scanning with python sockets ...!
I'm done with port scanning . But i want to detect the services name may be i can get service name using this func (socket.getservbyport()). but i'm not able to find their versions plus the OS detection using sockets.
Can i get this info using sockets.?
I've googled but didn't find any clue.
I'll be very grateful if you guys give me any clue.
Thank you

ember ledge
#

to the remote server

#

and then it just checks what service is usually run on this port, but this information is not retrieved from the server

#

its retrieved from common knowledge

#

whereas "versions" and "OS detection" actually require sending some data to the server and then processing the data returned back

woven vortex
#

Hi everyone, I'm really curious how the internet works, browsers and their protocols, how applications communicate, .. etc. I feel I'm ignorant about these things and missed out what people have been inventing since 1970 till now!
My question: for those who have little expertise please guide Me by sharing resources and what to learn first , what to learn after!

ember ledge
#

someone had similar question

woven vortex
ember ledge
#

really just focus on these 2 videos

#

they explain what is networking

#

and the general structure of the "messages" on the network

#

yes the rest of the videos arent ordered, but those 2 are the ones that matter the most

#

oh and that one

#

@woven vortex the order to go with is: networking, world wide web, OSI model

#

the other videos you don't even need to touch for now

empty folio
#

Hello. I am really interested in the feild of WAN Optimization and I know that it is a very uncommon feild for people to work in but I am very invested in how I could improve my internet with maybe , code? Idk. Does anyone know any useful recourse about this feild?

woven vortex
drowsy raft
#

What's a "frame" In http 2? From what I read, it sounds like a http 2 packet

cedar forum
#

you have a HTTP2 stream, between the client and the server

#

and then on that stream messages are broadcast, a message can either be a headers frame or a data frame

#

multiple frames can go on the same connection, because there is a cool bit of tech called http2 server push where servers can include additional content that they think the client might request and saves a bunch of time instead of having the clients send out for it

drowsy raft
#

Ohh i see

ember ledge
#

How do I make an IP logger and IP blocker (from my site) with flask?
Ping me please. Thanks.

fallen mesa
#

hey guys does anyone know how i can transfer AWS route 53 registered domain to cloudflare
because when i try to point the nameservers towards cloudflare, it never detects it
thanks 😄

ember ledge
ember ledge
visual raptor
#

I have a question about checkSum in ICMP packets and how it's generated

#

I understand that it's purpose is to check the validity of a packet

#

but can I for example set it to whatever I want? I'm learning about ICMP packets and I'm curious how the checkSum is generated

#

I did reading and understand its function but not how to create it?

#

And let me know if I'm appracoching this wrong but I am creating ICMP packets using struct.Pack(type,code,checkSum)

#

obviously checkSum is set to 0

thorn stratus
#
#

you split up the icmp header into 16 bit words and then you sum them

#

the checksum is literally just a sum of the words in the header

hollow lark
#

Hi, why do we need to encode things before sending them around. I get the theory but why do we not need to do this when printing something for example? I mean the computer is always working with byte values so why does this conversion get done automatically for us when printing something but not when we want to send something over a socket? or am I completly on the wrong track...

visual raptor
#

So if the type is 8 we have to change it to 1000?

#

and then pass it we cannot just pass 8?

earnest blaze
#

Python has many many abstraction layers.

hollow lark
earnest blaze
hollow lark
earnest blaze
#

What would you be encoding exactly?

hollow lark
#

So for example if I would want to send a dictionary over a socket I would have to put it into a string first and then encode it

earnest blaze
#

Yes

hollow lark
#

Why is that though? I mean in the end it needs to be converted into a bytes object somehow in order to work with it so why does the encode method not work?

earnest blaze
#

This is the c implementation of the dict class.

#

This is is what a dict truly is

#

Now, how do you encode that?

hollow lark
#

Yeah, well I dont know but in the end it needs to be encoded somehow right?

earnest blaze
#

You're merely encoding the strucutre and content of the dict.

#

A dict is much more than that, you aren't really encoding the object in of itself.

hollow lark
#

Oh Ic so much more the keys and the pairs?

earnest blaze
hollow lark
#

More than encoding the dictionary, just the values and the keys get encoded?

earnest blaze
#

More or less, the strucutre is then translated into and inferred from characters, like {} : , etc...

#

It's like translating the dict from one medium to another

#

A string representation of the relevant content.

#

Which can then be used to reconstruct the actual object back up

#

You don't want to send the hashing algorithm the dict uses, you don't want to send the method that sorts it.

#

Just the relevant data.

earnest blaze
hollow lark
earnest blaze
hollow lark
#

Why is there no method in the dict class that does so?

earnest blaze
#

Because not everything need be stuffed into one class.

earnest blaze
#

The one thing to take away from this, is to seperate your perception of a dictionary, from that of the interpreter.

#

Data is meaningless unless interpreted.

#

And then there's pickle and marshall, but we don't talk about those.

hollow lark
earnest blaze
hollow lark
random trout
tame prairie
#

if im trying to make an application using wifi and it has a client mode and a server mode, i tried connecting the client to the server but the connection failed, i think its because the firewall blocked it, how do i let my apps talk to each other over wifi?

ember ledge
#

what operating system are you using

visual raptor
#

How do we send an ICMP packet I have created a socket as such: socket.socket(socket.AF_INET,socket.SOCK_RAW,socket.IPPROTO_ICMP) and was wondering how we could conncet to it as when I try then connceting to it using an IP it denays the requests and says that it needs a tuple not a string

tame prairie
placid fractal
#
sock = ...
payload = {"d": "Some Command"}
sock.write(json.dumps(payload).encode())
#

then on the other side

data = server.recv(1024)
original_payload = json.loads(data)
...
sharp aurora
#

Hello, do you guys have any YouTube tutorial to make my little python server communicate with a web page (so "connect" my python server to JavaScript) ?

prisma cobalt
sharp aurora
#

Oh I'll look into that !

covert atlas
#

Anyone have recommendations for proxies that are fast and have a competitive price?

true notch
#

I'm to send a .png file using sockets by reading the original file and writing it into the server directory, every time the file has come out corrupted because it failed to decode it. Is there a way to decode png files, I can't find an easy answer on how png files are encoded online. Maybe there is an easier way to transfer files that I don't know about.

ember ledge
#

How are you sending the png file

#

!paste

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.

restive matrix
#

what just happened

true notch
ember ledge
#

can you post the code

#

!paste

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
#

you can remove confidential stuff

livid matrix
#

what topology is best for internet cafe

earnest blaze
#

Not only that but reading arbitrary amounts of bytes without establishing an app layer protocol is not the greatest idea.
You can end up reading more data than you need to and end up with mixed and fragmented useless data.

#

Yes you can perhaps get away with it on your local machine because of the loopback interface, but once it's actually multiple machines communicating, things will get ugly.

ember ledge
#

bytes(str(fileSize))

#

and bytes(str(scrnshtData))

#

scrnshtData is already of type bytes

#

when you convert it to str and then back into bytes

#

perhaps some data is being lost

#

so remove those conversions to string and see if it solves it

ember ledge
#

how can i get a requests authorization header

distant pilot
#

r = requests.get('<MY_URI>', headers={'Authorization': 'TOK:<MY_TOKEN>'})

deft phoenix
#

hey. i am trying to reverse engineer a post request, where you can upload a profile picture. does someone know what type of request this is?? its uploading base64 somehow but why does it look so cracky?

prisma cobalt
ember ledge
#

here is how a request of content type multipart/form-data

#

looks like

#

think of "boundary" as a separator

#

note how first parameter being sent is just a integer value for key MAX_FILE_SIZE

#

and second parameter is the actual file we want to send, with binary data inside

#

but the cool thing is that we can combine the two, regular data we want to pass as well as the actual binary file

plush coral
#

hi

#

I am trying to post code but it is not working ?

#

why?

#

url generated for Streamlit not working properly. ngrok tells me to register again even though I have already registered or gives me an erro

steep musk
#

the ngrok.io link is getting caught in our filters