#networks
1 messages ยท Page 4 of 1
Ok thanksyou
hello, does someone know something about webscraping? i have a problem and don't take all the html from the website
You'll have to be more specific than that. What response are you getting?
hey, i have written a simple connection listener with socket. After i see that script run mb 1min than crashes i log everything.
Now i see, there so many unexcepted logs from uknown ips on my root server.
that are all any GET Requests that causes the socket server crash
should i use a other port?
Hi, I am trying to make a encrypted client to client communication system. The road block I hit is with fire walls. How wold I listen for a UDP package behind a fire wall?
Hello, i am struggling with how to control Microsoft Edge using selenium, whilst using TOR to give me a random IP Address. Not only do i need to do this, but i also need to make the exit node have an IP Address that is from a specific country, which is usually done by editting the torrc file, but i am unsure how to use those country settings using TOR with a browser that is not the Firefox browser preconfigured with TOR, that you download.
ive been stuck at this for days now, i need to run multiple instances of a browser using tor, each with a differant ip but within a specific country
can anyone help?
@last ore your favorite
his books are great too
Is this different to sockets?
i think so but the functionality is the same
Hey all just reaching out
except KeyboardInterrupt():
print(" + CTRL + C has been pressed")
print(" + Program will exit")
sys.exit()
#If hostname is wrong
except socket.gaierror():
s.close()
print("Invalid hostname {}".format(remoteServer))
sys.exit()
Seems like my error checks arent working what am I doing wrong?
Im making a little port scanner for my home network
oh truly? ive only heard good things about them. will pick them up then.

Is it possible to use ngrok with python to open a tunnel to a specific port (ex. 25565). I found an official library from ngrok but cannot decipher what i need to do in order to create this tunnel and get a public url
networking is my thing
Python provides two levels of access to network programming.
I am using Fabric and Paramiko to upload some files to an SFTP server. Is there some way for me to check whether a file exists AND whether its size is the same as the file that I want to upload?
I want to do this because I want to upload multiple files. Currently, my function just restarts the entire process of uploading all files anew if the connection is lost at some point or another error occurs.
Hey everyone,
I'm trying to get out of tutorial land by writing python every day during my lunch break. Here is what I wrote yesterday. I'm hoping for feedback on my code. Remember my goal is to consistently write code. However if anyone has advice of how to write in a more pythonic, efficient way - I'm open to instruction!
import matplotlib.pyplot as plt
from pythonping import ping
samples = 1000
rtt = []
loss = []
def test(dest):
global samples
while samples > 0:
results = ping(dest,count=10)
rtt.append(results.rtt_max_ms)
loss.append(results.packet_loss)
samples -= 1
if __name__ == "__main__":
test('1.1.1.1')
plt.plot(rtt)
plt.plot(loss)
plt.title('Ping Plot')
plt.xlabel('Samples')
plt.legend(['rtt','loss'])
plt.savefig('graphic')
Can someone help me on installing the SQL
everyday we stray further from networking ๐
One more thing...is Django the best framework for websites, or is there another better language?
is it possible to do
username1, username2, username3 = None
Instead of:
username1 = None
username2 = None
username3 = None
hello, if i have 2 programs which i want to communicate with each other can i get some help here?
use socket
i tried but it tells me : ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
username1 = username2 = username3 = None
is ftp file requesting when you create an username and password in the ftp service and then create a file in the laptop text editor?
Hello, is there anyone here that knows a lot about sockets? (specifically RAW_SOCKET)
I'm trying to send a SYN packet (that I created) and receive the answer with sock.recv(1024). It works when I do it synchronously but when I run the function in multiple threads it starts doing weird things (answers that have nothing in common) even tho it looks ok in wireshark
lol, why dont u use scapy
I tried using it but it was very slow
true
and it did bad when I threaded it
how you send syn using socket? s = socket.socket()?
swear thats pycharm
Nah that's VSC
for raw sockets (or generally anything not a TCP socket), you probably need to use recvfrom() instead of recv(). The reliability of TCP streams is simply not available with raw sockets, and using recv() probably doesn't make much sense (never did anything with raw sockets myself though, but that's my assumption).
Hello friends, I am trying to make a server client application with python socket. If the server is open with a loop in the client folder, there is a block like connect or try to connect again.
I can connect once without any problem.
but when I turn off and on more than one server, the client does not connect to the server a second time.
Please I would be very grateful if someone who knows python or understands these issues can reply.
thanks in advance
hi
I want to differentiate one client from another client, how could I do it (using socket library)?
Everytime a clinet connects store their ip on a list
ohhhhhhh, yeah that is really simple
THX
goodnight too
Does anyone have experience using closed/private protocols? I have to decode bytes and encode bytes based on different states stored in the DB and/or returned from the device (the network protocol I am implementing is between a server and a device that communicate with each other). Any device and tips would be very much appreciated
anyone know how to spoof cors exchanges using requests? im trying to use selenium to login to a website and then access their api but they're using cors
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
is there anyone who have implemented routing algorithms in the past
hello ๐
is there any possible way of making a socket connection safe from bots that are joining randomly?
i recently tried making a socket connection with a pygame app i made and it worked, but the only problem is that i noticed that bots were joining and such
so i need some kind of a secure way of making the socket connection
you could implement a passphrase that has to be passed between client and server connection before socket connection takes place, else: dump connections, or you could implement secure socket with SSL and exchange keys between client/server
if passphrase == 'None': terminate connection, etc...
This is what I used a while back https://github.com/Rob--W/cors-anywhere
There is kind of a lot of information behind the main differences between an iterative and recursive DNS lookup. Here is a good link which clearly explains the differences, and why recursive is not really used any longer.
https://www.cloudflare.com/learning/dns/what-is-recursive-dns/
Hey, does anyone know if I can use those HTTP drafted request in HTTPClient in Pycharm, if I can reuse those in Main.py?
sorry im a total noob, I cant really find anything about it ๐
Hello can someone tell me how to connect 2 Computers with phyton?
You need a USB dongle in one of the computers.
You make the snake bite the dongle and stick its tail to a port in the other one
Try using a very high port number
Oh okay thanks ill try that
a
who can help me with openssh & putty
which wireless IEEE standard has the highest bandwidth? and is common
import random
import string
import time
import requests
def generate_urls(base_url, num_urls):
"""
We add random characters to the end of the URL to break any caching
mechanisms in the requests library or the server
"""
for i in range(num_urls):
yield base_url + "".join(random.sample(string.ascii_lowercase, 10))
def run_experiment(base_url, num_iter=1000):
response_size = 0
for url in generate_urls(base_url, num_iter):
response = requests.get(url)
response_size += len(response.text)
return response_size
if __name__ == "__main__":
delay = 100
num_iter = 1000
base_url = f"http://127.0.0.1:8080/add?name=serial&delay={delay}&"
start = time.time()
result = run_experiment(base_url, num_iter)
end = time.time()
I tried running this code but the connection is refused.
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /add?name=serial&delay=100&kyxegsiftm (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f10d4be0520>: Failed to establish a new connection: [Errno 111] Connection refused'))
Do you have a web server running on port 8080 on your machine? Can you open that URL in your browser?
Hello.
I'm having some difficulties understanding the fifth layer, the Session layer.
I have watched some videos, read some articles, but it didn't help unfortunately.
The session layer does what it says - it manages sessions between two devices. What is it that you're not understanding? What is it that you're trying to accomplish that your lack of understanding is preventing? If you ask specific questions that pinpoint where you're having difficulty, you're much more likely to get assistance.
With wi fi...
Hi guys, i'm trying to send some data over blueetooth, and... well... i'm really having hard times making it... I've found this https://blog.kevindoran.co/bluetooth-programming-with-python-3/ to help out. As i couldn't manage to install Python Bluez on my linux (Pop OS), i tried with sockets as explained at the begining but everytime i get an error on "s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)" saying "AttributeError: module 'socket' has no attribute 'socket' "wich is quite odd because everywhere i look for examples, i find this syntax (even in the documentation it's the right syntax!!) !! Like here for instance : https://www.programcreek.com/python/example/116470/socket.AF_BLUETOOTH ... I have to admit... i'm running dry and was wondering if anyone as some experience with Bluetooth and sockets ??
Bluetooth Programming with Python 3 written Apr 21st, 2013 This post presents basic techniques for communicating over Bluetooth with Python 3.3 and โฆ
This page shows Python examples of socket.AF_BLUETOOTH
i believe you have from socket import socket at the top of your file
it should be import socket instead if you are using that code
No i have import socket
Perhaps you have made a file named socket.py in the script's directory
no it's client.py (see top of the image...) i've spent a looooot of time on the possible errors and i still don't get it... i've even tried "s = socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)" and then the error goes on socket.AF_BLUETOOTH telling me socket doesn't have an AF_BLUETOOTH attribute where it clearly has since V3.3!! : https://docs.python.org/3/library/socket.html (i'm using 3.8.5 !)... Where's my pill ? Yeah the pink one... i need it...
More Fun :
Could i have a corrupted socket.py library ?
I wasn't talking about the script, I was talking about a file named socket.py in the same directory as client.py
hi, it is posible to send messages through a server - client chatroom without the client having a open port?
<@&831776746206265384> ads
Can you expand your question?
What do you mean by having a port open?
nothing i resolved it thx btw
can i have help again?
Hello,
I'm trying to recreate an issue that I've observed in the wild. The issue is that long lived TCP connections are eventually timed out ungracefully by network appliances which are tracking state. These long lived TCP connections are not using keep-alives.
However I can't find any use-case where it is a good idea or recommended to use a long lived tcp connection...
Has anyone ran into this same use-case?
The most common case is long polling.
the only long lived tcp connection I remember, was back in the days when I was still on IRC.
Realistically I dont think it's done much anymore outside of very legacy setups.
How could I decode socket byte data into something readable?
can anyone suggest me good sources to learn about network prgramming like request,http and how front end and backend works amd programming backend?
struct module is usually the way to go in python, if you need to decode arbitrary binary data. but depends on what data you're working with.
I'm using struct.unpack(), but is there something else I can do?
might be. Usually I use struct, if there is no alternative 3rd party library for that specific protocol you're using
what do you mean by "interpret that"? there is no general way that always works. You have to know in what format the data comes, and have to unpack/decode it appropriately.
oh okay
so then there are many different encoders being used, I assume?
if so, would there be a way to decode something like that
something like what?
like what?
I'm getting my raw data from socket
wait, I don't think I unpacked all of the raw data
you have to know the format of the data you receive, to be able to decode it correctly.
that's called a "protocol"
right
there are thousands of documented protocols, and probably many more undocumented ones.
I'm able to determine if the protocol is tcp, udp, or icmp
that's a different layer
what data are you receiving and/or sending?
what format is it in?
wait sorry what do you mean by format?
format or protocol.
it's the "format" the server and client agreed on, to exchange their data in
TCP and UDP are on a lower layer
you use those likely anyway.
but the data that's on top of that, your application data (the stuff you .send() and .recv())
that can be in a different format, relatively independent of the underlying TCP/UDP
you decide it. Assuming you write both server and client, it's up to you how you package and send your data
if you don't write the server, but just connect to one, then you need to know what the server expects. read it up. Look at documentations etc.
or find a library that already does what you need ๐
oh okay thanks for the help
I'm pretty new to all of this
do you have any recommendations for something that just lets me read packets in a network?
wireshark probably?
but most data (esp. http) is nowadays encrypted, so it might not be useful.
so when analyzing packets, its mostly done from looking at sources and destinations and such?
how is malware detected then, for example
no idea
alright, thank you for the help though
why?
What is networking
Computer networking - the science of studying how computing devices are interconnected
Oh
self hosting: would it be be easy to set up a pi as a server if the pi is connected to a wifi connection? Is that any different than an ethernet connection directly to the router (besides latency)?
use the forwarding url to connect both?
ok wait.
the long link
this link
change 127.0.0.1 to whetever ngrok link and try if it connects
also ping me..im not gonna see this channel much often
yup
ok
should work now
hmm...
what now
i dunno man...im not that into networks....it shoulda worked...
what do you want to do?
make the Server.py
https://bf6a-2604-2d80-5084-9f00-550a-ce1a-fbe8-5a46.ngrok.io
@harsh beacon
yep a minute man
ok
@pale prairie is the server running on your local machine?
i think
it is on my machine
@harsh beacon
how i fix that
error
i dunno tbh
you just keep googline crap unless errors change and eventually it works
try this @pale prairie
https://www.geeksforgeeks.org/socket-programming-python/
it looks similar to what u want
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
will it go like for other machines
hmm...good question..i dont think so...lemme find another
ok
most of the online resources seem to have localhost sockets man
this is the only way
and i cant findd
i cant find much on intra wifi sockets...
hmm......
maybe someone with better experience can suggest ig...im at my end too .
@lofty bough
I been making my own thing
@harsh beacon
look
i decided to make my own
wait
@harsh beacon
i think it is going good
just gonna add a debuger with flask
hello?
๐ซ
@harsh beacon
i actually do need u
are you familiar with socket.py?
@lofty bough
How do i use ngrok in socket.py?
.
@ember ledge
?
can help?
with what
so in socket.py u can only use localhosts but with ngrok u can turn that localhost public where anyone can join ur server
@ember ledge
yes
so i want it to be public where anyone can join the server without being on the same internet
@ember ledge
so can u help?
?
u dont understand
@ember ledge
Well I can make it alive , I m having issues with Paramiko
well issues is not the right word. .. I don't know how to use it and accepted a project too big for me ๐
Hey yall, I'm having a slow UDP server issue. Video captured with CV2 is streaming at 3fps. I'm over in help-cake is anyone can help ๐
hi some here?
anyone use tailscale/headscale?!
if not, you need to stop everything you are doing and hook yourself up right now
hook to what?
oh crap sorry wrong chat
Hello I am trying to login to a website using python requests but I am not sure wat data I need to send. How do I figure it out?
You can use the network tab in your browser's dev tools
Ye took me a while but I got it thanks ๐
what is a nic
what is a switch
what is a hub
what is a router
bro use playit.gg
its easier
i hv a question in sockets
why does my server go blank after i disconnect ?
this is wht happens
anybody knows the sol?
Guys for learn networks is important known how works bits to bits or know who works?
hi
That's the OSI physical layer, though not very interesting. If you on an overall basis know how it works; you'll be fine
Why don't you try to explain what those 4 are, and we'll check for gaps in understanding and fill them in?
I want to say, example: know how the works checksum and another things that have in segment, know how works bit to bit is important?
anyone knows about cisco packet tracer?
Yes
It's a simulator of networks
can i dm?
What do you need?
there was a power outage i have to deal with in this cisco packet tracer
Well I don't know
I just use for make LAN and WAN
Try search on YouTube, maybe help
yeah i am trying to watch some
Sure, you can ask here though
We use PT frequently in our classes
To enable access vlan:
enable
configure terminal
interface F0/1
switchport mode access
switchport access vlan <VLAN_ID>
Where interface is each interface
i gotta ttry that
You can use interface range if you want to edit multiple at once
What vlan should these ports be assigned to?
Right, but what VLAN ID should they be assigned to?
int range F0/1-9
switchport mode access
switchport access vlan 50
i forgot the ACL
but i have done it like 2 months ago
i am so bad at recalling stuff XD i just got back from thanksgiving break
im afraid to fail this but my instructor said that it should not fail me for just this task
luckily techacad to the rescue
yeah i always watch him
helped me a lot through my homeworks
sometimes i do not have to watch him because I could do it on my own
@zealous flint do u know this syslog client thing?
no unfortunately we haven't worked with that before
How come ipconfig tells me my ipv4 address is not the same as when I google whats my ip?
Hi how does a TCP connection add overhead relative to UDP
Hey, im a college student doing a project, and subnetting has never been my strongest suit same with Static routing, could someone go over my numbers and check if im good or not?
ipconfig gives you your private IP while googling your IP gives you your public ip
TCP needs to make sure that a packet arrived - that in itself adds overhead. It also needs to make sure the packets arrive in the right order. Again, overhead. UDP doesn't care as much - it just sends the packet to the other computer. If the other computer failed and isn't listening - oh well, too bad. Packets arrived in a jumbled mess? Oh well, too bad. Packets didn't arrive at all? Oh well, too bad.
I don't really understand private vs public?
hiii, Iโm searching for a co founder who is experienced in programming ๐ would love to be able to connect to some like-minded homies here ๐
Let me give you an analogy -
Your private IP is similar to where you are in your house. For example, you may be in your bedroom at the moment. Or the living room, or in your kitchen.
Your public IP is similar to your house address. You may live on XYZ Drive, State, Country.
If someone asks you for your mailing address, would you tell them you live "in your bedroom" (private IP), or "XYZ Drive, State, Country"? (public IP)
yeah so when I do something on the internet it only sees my public ip right? The one on my router or my isp?
Yup! When you browse the internet, all sites you visit will be able to see your public IP (which is the interfacing pointing out on your router)
All of the devices on your LAN will have the same public IP
The "default gateway", which is analogous to your front door
The mailman delivering your package will leave it at your front door - and from there whoever is meant to get the package will come and pick it up from the door. This is called "NAT" which stands for "Network Address Translation"
Yes but when the response returns how does the Router know which internal IP to send it to?
I believe the private IP will be embedded into the packet (not 100% sure on this part though)
and its the same if the ISP does the network translation for my entire network?
Like if an ISP manages 2 routers that has the same IPv4 it first translates for the network and then the network translates for the devices on it?
2 devices cannot have the same IPv4
Perhaps you mean the devices behind a router appear to have the same IPv4?
Like, when I check what my default gateway is on one network it is 192.168.0.1 and if I do the same on another network I get the same gateway
The default gateway is usually always the first usable address in a subnet
So that's not much surprise
In fact my default gateway is also just that
private IPv4 can be duplicated across multiple LANs, but public IPv4s are globally unique
Oh wait so the default gateway is not the address of my router?
It's the address of the interfacing connected to your LAN
Unlike a host a router can have multiple IP addresses, one for each interface
"One interface", being a physical port
(Note that it can get a bit more complex with subinterface and virtual interfaces, but you can ignore that for now)
im lost. Wdym by the interfacing connected to my lan?
I thought my router "created" my network
For example, this might be your interface
You see the wire coming out of the router on the right side?
That would be the default gateway
It's IP would be something like 192.168.0.1 (though in this diagram it's 172.31.1.129)
circular or square is my router?
yeah im with you
And if you can make it out, there's another wire going from the router to the top left
That would be the router connecting to the ISP, and ultimately the internet
So when I'm sending a package to 192.168.0.1 im sending it to my router?
Which is your public IP
Yes! You can test it by opening up a command prompt on a windows machine, and typing in ping 192.168.0.1
All packets leaving your LAN have to go through the default gateway
Similar to how if you want to leave your house to go to work, you have to walk out the front door
yes but wouldn't that mean that my routers IP is 192.168.0.1?
Just one of it's IP
Your router can have more than one IP
How does that work
In fact a router will usually never have just one IP, that defeats the point of a "router"
One for each physical port
The one that you're connected to has the 192.168.0.1 IP
How many IPs does it have from my ISPs perspective?
From your IP's perspective just one, the cable connecting your router to your ISP
Same deal from the rest of the internet
You can think of it as "how many doors does my house have for someone looking at it from the front?"
back to the fact that to different routers has the ip of 192.168.0.1 then lol. To the ISP it has to seem like there are two devices with the same IP?
Or do the routers have another "secret" IP that I can't see that is unique to the ISP
No because 192.168.0.1 is the one pointing towards the "inside" of the LAN network
This is your public IP
For example take this topology
R2 would be the ISP's router
Let's say you are R3 and R1 is your neighbor
Notice how the wire connecting from R2 to R3 as a different IP that the one connecting to the LAN with PC3? (this will be your home computer)
So from PC3s perspective the router has the IP of 172.31.1.128 while from R2s perspective the router has the IP of 172.31.1.196?
Exactly like so
So this is kinda accurate? In that the router has one inwards IP and one Outwards to the ISP?
Not just kinda, you were spot on!
Keep in mind a router can have more than just an "inwards IP" and an "outward" IP however your average Cisco router will have only 3-4 ports
This is the entire topology for something I'm working on for school
In this case you can see R2 in the middle has 3 different ports
Does it have a fourth port aswell that connects it to an ISP?
Yes, this router has 4 ports: 2 GigabitEthernet ports, 2 Serial Ports
You can see that here, in a typical Cisco 1941 Series Router
aha cool
Im guessing R2 has the same IP from the perspective of all the things connected to it? Does it have another IP from the perspective of the ISP? Also are those squares switches?
Not quite, PC1 will see 172.31.1.192, PC3 will see 172.31.1.128, and PC2 is directly connected so it will see 172.31.0.0
Though PC1 and PC2 can access it from any of the other 2, it would be like going into your house from the backdoor. Like sure it's possible, but you usually wouldn't do that
This is also why you can ping your public IP (it would be like PC3 pinging R3, but from the other side)
Oh yeah im with you on that but from R1 and R3?
Like to both R1 and R3 R2 has the same IP?
No, to R1 and R3 the IP would be the same as it is from PC1 and PC2
This is because the link between the routers is not actually a regular link, but a "serial" cable (which is why it's a red zigzag)
Since when you directly connect multiple routers together, they can behave a bit strangely
Huh, so to PC3 the address of R3 is 172.31.1.128 and to R3 the address of R2 is also 172.31.1.128?
You're right on PC3 and R3, but to R3 the address of R2 is 172.31.1.196 (as that's the IP connecting R2 and R3)
believe it or not the links connecting the routers are their own LANS:
This picture is the same as the one we have except it's IPv6, so you can ignore that part
But each of the pink highlights is "a LAN"
Another way to think of it - each wire coming out of a router is a LAN
Oh and yeah - forgot to answer this. The squares are switches. No network is complete without a switch!
I don't understand what you mean by one IP connecting R2 and R3? I thought there had to be atleast one IP on each device to connect them?
Ah yeah. So like I mentioned the link between R2 and R3 is actually a whole network on it's own. Same deal with the link between R2 and R1. All networks have a "network" IP - for example 192.168.0.0. You cannot assign this to any device. I can try to set my computer's IP to 192.168.0.0 but it would error out. So your router takes the "first usable address" which is 192.168.0.1. Your switch takes the second, 192.168.0.2, and your PCs the rest - 192.168.0.3, .4. .5, etc
So those IPs on the diagram are really the "network IP"s of each network
aha
So on the vlan that has PC1 on it R1 has a certain IP while on the VLAN with R1 and R2 R1 has a different IP?
Right - though I'd avoid the term "VLAN" as it means something a bit different and can trip you up :P
VLANs are more complex so it's best not to confuse yourself with them just yet
All you need to know is that "VLAN" stands for "Virtual LAN" so it's not exactly a physical, real LAN
Of course!
People say that you shouldn't "leak" your IP. What do they mean by that?
Giving our your public IP. It's like telling people where live, and your house address.
These days it's not "bad bad" because most people have dynamic IP (it costs more to get a fixed IP) so given a few days to a week your IP will naturally change.
The bad part is that they can (D)DoS you - but even then modern ISPs have protections in place to prevent their customers from getting a (D)DoS attack.
They can also know your rough geographic location (plus or minus say, 5 miles)
It's not a major deal but you know
Don't go telling people what your public IP is, lol
However you can tell people your private IPv4, that doesn't really matter much. In fact, here's my private IP:
(i'm on the 192.168.1.0 network)
But to reach my network, wouldn't they have to know both the ISPs and my routers IP?
Router (default gateway) takes the first IP as usual, and my PC just happened to take .228 because it's using DHCP and I can't be arsed to manually configure it
I don't know much about how ISPs works internally but they have it set up in such a way that it's as if your router is directly connected to the internet
So they just need to know your router's IP
And of course using a VPN mitigates all of these risks
Moral of the story: use a VPN
I'm currently working towards a CCNA certification to become a network engineer as a dual-enrolled student
So we concern ourselves mostly with this sort of stuff
It was nice chatting with you! I hope I made things clear and not the other way around :P
guys is it important to know how flow control with bits works, and other things like checksum or just know what it is for?
Hi, I need someone to go through my code and probably optimize it
It's the config file for an SNMP
Im going to get that
does python still support socket
yes, socket is a core library
can you guys suggest some book about django
Web Development with Django
When I try to connect with paramiko module, I get this error: paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[WinError 10054] An existing connection was forcibly closed by the remote host Even if I try not to display this error, using try/except keywords, it still show on my screen.
CODE:
>
try:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host,username=username,password=password,port=22)
with open('vps.txt','a') as file:
file.write(host+' '+username+' '+password+'\n')
file.close()
except Exception as error:
if 'Authentication failed.' in str(error):
print("ERROR")
return
Someone who can explain me that?
how to fix this error?
Hey @spiral pond!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
How can an application evade fiddler?
The application works correctly regardless of whether Fiddler is running or not
So there's no anti-Fiddler stuff going on either
why do you want to evade fiddler?
They're using an abomination Called CG Nat nowadays where even your router is inside a "private network". All of the clients requests are forwarded to a gateway router which then handles responses based on ports. basically nat just with ports. All that because no one wanted to switch to ipv6. Dual stack like, nat, cg nat are all inventions to combat ip address exhaustion.
True dynamic addresses are getting rarer
Even rarer are static IPs, which I'm actually not a fan of due to obvious reasons.

Rewrite all of it
Ooh thank you. Didn't it things were that funky behind the scenes!
It's an interesting technology, but for the end user it's an absolute disaster. It's time we switch to IPv6
indeed
Sure, since you're in the #networks channel Cisco provides certificatations
Microsoft provides MTA I believe they're called
When creating a REST API what is the best way to handle posting files (1MB+ data)? Is it fine to just post the entire data
usually a big file is streamed rather then sent at all at once
Where could I learn about streaming?
if you're using Fastapi, this is the resource: https://fastapi.tiangolo.com/tutorial/request-files/
otherwise, the Mozilla docs briefly mention it here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-enctype
FastAPI ๐
heres a resource that talks about chunked encoding and also links the spec
https://stackoverflow.com/questions/12167378/how-to-stream-an-http-file-upload-without-the-content-length-header
fastapi is amazing
I also had a fastAPI related question about Pydantic
@app.post("/createposts")
def create_posts(new_post: Post):
where Post is a pydantic model
How does the type hinting work here with a class? I've not really used type hinting a lot before. The course I am watching says it "automatically checks the contents of the post to see if it matches the model"
your Post class defines a few attributes that represents its structure
when a request comes in, fastapi will parse the given args and see's if it can match them with your Post object
So behind the scenes FastAPI and Pydantic are doing some functions/comparisons to see if the post JSON matches the post object
yes, and if it matches, a Post object will be created and passed into the function
if it can't match then the client will receive an error
by type hinting, you are telling Fastapi that you want to receive a Post object
type hinting doesnt actually do anything meaningful, it just tells fastapi how you want the request to be handled
that make sense?
Sort of. But the actual request is just a JSON object, how is FastAPI mapping the JSON to a object?
I had thought there was some kind of type conversion going on
Because, a Post object is not strictly a JSON object
an example:
class Post(BaseModel):
title: str
content: str
upvotes: int
the JSON in the request would look like this:
{
"title": "FastAPI Is Cool",
"content": "Whatever here",
"upvotes": 78
}
you can also nest models inside each other which is pretty cool
as is support for different data types like lists
Huh, magical
yo i have question about the python socket module
what happens when you do socket.recv()
You get the next message in the "queue"
I don't know if there's an actual message queue but I find it helpful to think of it as one
You read data from the socket buffer
what happens to the others clients that are trying to connect while you are stuck on .rcv()
i found out that you dont go to next line while .rcv()
is it like waiting for something to arrive
That line of code will block your program until there is something to receive, if there's already data to receive then the call competes immediately
so i have to make thread to handle multiple clients
That would work yes
Or you could handle them using some sort of selector in a single thread (an advanced topic, threads will work fine)
Where to learn streaming?
selector damm they sound complex. ima stick threads
anyone here finished with their comptia certifications?
and/or have completed net+ / sec+ ?
did anybody here manage to make a p2p connection with no public IP using a google stun server?
hello ! i started to make a socket in python but the problem is that the server is on my pc so my own ip and i don't really want the people who connect to my socket to get my ip do you have any idea how to hide my ip address ?
Own a server to which you will let people have the address
Preferably not in the same network as your home I guess
is there a way to detect when a client socket disconnects from a server socket? i could just do a while loop on a separate thread and check if the client is still connected, but that seems like it'd be inefficient and i want to know if there's a callback or something
guys I have a question...
I'm making an amazon Alexa skill, and I'm trying to control my pc over WIFI (with alexa commends)
do you guy know a way / python lib that could be usefull to control my pc
flask probably
idk how alexa works but if it requires a server on the other end you could do flask
and you could use an ngrok webhook to tie it all together
@dense escarp
is there any way I could use to download file from mega? (exe file)
ty
Selenium, or if mega has an API, do it that way
Hey , does anyone know loop back address in IPv6 other than ::1?
Like in ipv4 we have a range of loop back addresses , do we have it in IPv6?
how do I check if my udp server is listening on a particular port?
its for a chat app
Does anyone have any examples or resources on how to stream large data from client to service using grpc?
Maybe link local? FE80::1 or something like that?
Let me try this . Thankyou ๐.
i had a question about selenium, if i wanted other people with different browsers to use my thing could i pre-package a version of firefox or is there a better way?
hey @zealous flint , this also doesn't work
stuck with this issue since the last 3 days
Hello. How to enable internet access from github actions on github please?
yo
so I'm trying to figure out how to keep a session alive in python indefinitely
so if there was a website, I could login with my password and user, and indefinitely scrape stuff out of the website with that session
is that possible?
to be permanently logged in with a bot?
I want to scrape a forum/website with my login credentials and let it keep scraping indefinitely
or can I manually login to a website that requires a captcha, but can I grab the captcha and type it out manually
Quick question how long did it take for you guys to be decent at coding
it is ok I found the issue
Hi, I need help
hi, has anyone encountered the following problem:
To connect to a server, for example 1.1.1.1, you need a vpn (ssl vpn plus), if you install vpn on windows and try to connect via ssh, then the connection will be successful. If you write a simple echo server with port 8080 and they knock on it from Windows, it also works fine, if you install vpn on linux, then only the connection via ssh goes through, the curl to the echo server does not work.
Can a single port accept both TCP and UDP or just one of them?
Such that for example port 80 can accept both TCP and UDP packets?
Sure
Cool thanks!
Hi guys, I'm looking for a way to connect my app to a remote server, could you help me with the code?
yes they are separate spaces of ports
So one 80/TCP and UDP/80? And depending on the protocol used it goes to either?
@storm saffron
A port doesn't really have a concept of protocol
It just receives packets
Seagurkan said they are separate? How would they know which is the port for TCP and which for UDP?
I don't really know if "seperate" is the right term
It's similar to how your ears can hear multiple languages
You don't need seperate ears for separate languages
The port itself has no concept of a "protocol"
All it knows is how to receive packets and how to send them
Ah ok but then why can i specify which protocol to use for the port if it doesnt know?
The actual host machine is what knows
There's a "protocol" field in the packets
The host is like, "oh hey, this is UDP. I don't have to worry about all the TCP handshake stuff"
aha cool so its not the port itself that decides what protocol it wants to accept: Its the program that actually processes the packet that does?
aye
Hey @slow bobcat!
It looks like you tried to attach file type(s) that we do not allow (.docx). 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.
Hi, it's mustafa.. I am interested in python, data science, machine learning and sql. https://www.kaggle.com/mustafagerme
I am interested in the production of value-added products by fermentation processes in the bioreactor, optimization of pretreatment and fermentation processes using statistical software, modeling of the fermentation processes, purification processes, pretreatment processes of renewable resources, and detoxification processes. Actively, I am writ...
Hello everyone . I would need help regarding an event that has a high probability of happening while using my program , and it is an ip address conflict .
I would need to add a function in my python script , that checks if 2 ip addresses have the same address in the same network . I don't mean 2 or multiple ip addresses as strings , but it should really analyze the network and tell me if there are 2 ip addresses with the same address .
At that point the program would wait until this conflict is eliminated . How can this be done ? Thanks to all
There shouldn't be 2 ip addresses if you use dhcp
It's possible to accidentally configure 2 static ips tho
Yes I know . the thing is that these are devices that by default must connect to the network with an equal static address ,since this address is embedded in the firmware of these devices .
So this conflict event is normal to happen and I have to be able to wait until it is resolved (automatically it is done)
I would need a simple function that analyzes the network and checks for a conflict event .
If there is it should wait until this conflict is eliminated
Hm. You could take a page out of IPv6's book with DAD
IPv6 commonly has this issue with duplicate addresses
It uses a process called "duplicate address detection" or DAD, for short
Basically it sends a neighbor solicitation ping with the address as the destination
If a ping is not received, the ip is considered to be unique
You should be able to apply this same concept to ipv4
Right ! I hadn't thought about the "ping" command. , so if there is a conflict of two ip addresses and I try to ping the duplicate address , it should fail ?
In theory yes
Very Interesting , i'll try that and also DAD . Thanks for your help
Hello guys, I want to ask if it is possible to make a neural network in python so that it draws pictures and arts like a midjourney neural network
HI, every one i have some questions for my code and it's important to my career
I created a Network Analysis code but when I send ICMP or any other packet, I get an error. Is there anyone who can help me?
and i have a problem in return function
Anyone have a good tutorial series for networking/sockets? Specifically communicating between multiple clients through a server (multiplayer)
Anyone here able to do a quick run down for me about subnet masking
Sure. Do you have a specific question or?
So Iโm not sure how ipv4 Classful addressing works?
You don't really have to these days
Classful addressing was abolished
But if you really want to...
Oh dang they are teaching that in my class idk why lol
Mine did too.
Not sure why they still do it but hey, who are we to argue with the curricula, eh?
True
Hello, i am try to send a json file to my ip address and then use it on unity , i have the following python script
Any suggestion to what i am doing wrong? host = '0.0.0.0' # I have set my ip here??
import requests
import json
import time
# app = Flask(__name__)
# # app.config['CORS_HEADERS'] = 'Content-Type'
# CORS(app)
class PostClient(object):
def __init__(self):
self.url = "localhost"# set an ip address
self.ip = "5052"
# instantiate a channel
self.headers = {
'accept': 'application/json'
}
def post_message(self, msg):
"""
Client function to call the rpc for GetServerResponse
"""
example = {'command': 'summary'} #this would be the json msg to the server
example_json = json.dumps(example)
try:
response = requests.post("http://{}:{}/send".format(self.url,self.ip), headers= self.headers, data=example_json)
print(response.content)
except requests.exceptions.RequestException as e:
response = e
return (response)
if __name__ == '__main__':
try:
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('--host')
parser.add_argument('--port')
args = parser.parse_args()
# If the user has provided custom IP and port
host = args.host
port = args.port
except Exception:
# Use default values
host = '0.0.0.0' # I have set my ip here??
port = 5002
#app.run(debug=False, host=host, port=int(port))
post = PostClient()
while(True):
post.post_message(100)
time.sleep(1)```
I'm building a proxy server, and I have a couple of ways to implement it but I'm not sure which one is the best one to do:
option 2: make a new process for each user, and not run a thread for each connection this user have
option 3: make a new thread for each user, and a thread for each connection this user have
option 4: make a new thread for each user, and not run a thread for each connection this user have```
which one is the best?
Can someone help me with a server client problem? I transfer a file via Socket but I also want to give the filename. The way I implemented this now skips writing the file bytes
I got it
We're not allowed to help with exams sorry
I thought this channel meant โnetworkingโ as in getting to know programmers so they can help you. Though it looks like this is โnetworkingโ as in creating a network, right?
Common misunderstanding. Yes, this channel relates to computer networking - the study of how machines connect to each other and form a sort of web, and how they communicate with each other.
The closest thing I can think of to the other "networking" you mentioned might be #career-advice - though it may not be the right place for that
whats a tcp proxy (some resources pls) ? (edited)
proxy is a name for a server that reroutes traffic (https://en.wikipedia.org/wiki/Proxy_server)
TCP ( is a networking protocol in the transport layer, it's used to deliver error free messages (https://en.wikipedia.org/wiki/Transmission_Control_Protocol)
a TCP proxy is simply a proxy that uses TCP, note that it doesn't have to be called TCP proxy to use TCP, for example http proxy also uses TCP
what are your guys opinion on best cisco apps.. ansible, genie, etc.. I need to pick one and start learning it
F
?
i have the same problem
im learning network automation using python
paramiko and netmiko
Hi guys i had a problem in my code, i created python script for MySQL database and i used flask, every time i tried to run the script, it's response in this error:
||
RuntimeError: Working outside of request context. This typically means that you attempted to use functionality that needed an active HTTP request. Consult the documentation on testing for information about how to avoid this problem.||
I tried to search in google but i didn't find the solution, can any one help me?
hi,does anyone have experience working with ngrok in a restrictive firewall
while True:
s.listen(5)
conn, addr = s.accept()
print("User" + " " + host + " " + "has joined")
welcomeMessage = "Welcome."
conn.send(welcomeMessage.encode("utf-8"))
data = conn.recv(1024).decode()
print(host + " " + "wrote:" + " " + data)
hello, i can only seem to send one message to the server
once i send the message to the server and try to send another it doesnt register anymore
im using inputs on my client side
Kind of late, but this is wrong. Understand the basics of IPv4 and Subnetting. Network ID, Broadcast addresses and usable hosts are important to know. Lets say you have following IP address 10.0.0.66/27 in this case the Subnet Mask is 255.255.255.224. So you have 5 bits out of 32 you can fill. 2^5 is 32 so from 64-95
Broadcast Address is the Last Address
Network ID or Address is the First Address
First Host is the first Address after the network ID!
last Host is the Address before the Broadcast Address
Everyone uses a different method to calculate subnets, you will have to find out what suits you better
In select, how can i check if my socket connected to the server?
I for the life cannot figure out how to check if my non blocking socket has connected, working on kernel 1.0 linux.
It states, when a socket is connected it becomes readable, all is well, but when the server it connected to sends something it becomes readable and writable, which is a problem because its our only way to check if the socket is errornous
Hey @ember ledge!
It looks like you tried to attach file type(s) that we do not allow (.c). 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.
could you share some code? its hard to know what the differences on a 1.0 kernel might be without a example
it doesn't matter, just send the example.
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.
you can assume when someone tries to help with answering your question on the python discord that this person knows python well enough
It's written in c
Yeah sorry
you are never able to detect a silently broken socket - like for example if the connection is killed by the other side without a proper log-off
thats impossible simply by how socket connections work
So the conclusion simply becomes, to ping pong application layered?
you're already using getsockopt with SO_ERROR which is able to detect any other errors so yea, the only thing left is keepalive or ping
Now, who pings who?
it ultimately doesn't matter as long as both parties are aware of the rate at which the pings should come through
What would you suggest?
And you are 100% sure there is no other way besides ping pong?
you might want to try keepalive first
the old kernel i work on has no getsockopt and or those flags
it does not even have send(), recv() so i need to use write() and read()
ah yeah if keepalive is missing you have to manually implement something similar
do you have control over both client and server?
Ye
okay yea
Luckily
which side sends the ping would depend on the actual application
ask yourself: for which side is it more important to immediately know a connection is terminated?
I want to use epoll() or asyncio + uvloop + asyncio tcp streams
on the server side
I know epoll() just works
but i'm really curious to the performance of asyncio
then i would send from the serverside
the client has to connect to the server to revive further instructions, like updating etc
that depends on what performance requirements you have, do you only care about delay? cpu usage? memory usage?
yeah then i would make the server initiate a ping and the client acknowledge it
Ah you mean as soon as the server gets a client connection, the server sends the ping?
not really? just periodically
how often depends on how fast the server needs to know
it has many clients that connect
and it would have to ping each
yeah
How do I expose my localhost with a tunnel and use my custom domain?
this is just a part of my code i have the chromedriver exe in the same directory as my code in but i still keep getting this error below:
[4104:2584:1217/000435.860:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
[4104:2584:1217/000436.126:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
[4104:2584:1217/000436.169:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
[4104:2584:1217/000436.497:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
from selenium import webdriver
d = webdriver.Chrome()
d.get('https://uscash.sbs/')
i have tried everything i can, be it mentioning the path of it in the webdriver.Chrome(path) like this or even using an auto installer of driver with chromedriver_autoinstaller.install()
but all of it doesnt work
can someone please help
how do i fix this ssl handshake error
i also used this but it didnt work either
options = webdriver.ChromeOptions()
options.add_argument("--ignore-certificate-error")
options.add_argument("--ignore-ssl-errors")
browser = webdriver.Chrome('C:\\webdrivers\\chromedriver.exe',options=options)
hi, is there a way to encrypt a connection to a server so the connection cannot be sniffed?
Hey @gilded vigil!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
`# Import subprocess so we can use system commands
import subprocessImport the re module so that we can make use of regular expressions.
import re
netsh_output = subprocess.run(
["netsh", "wlan", "show", "profiles"], capture_output=True).stdout.decode()profile_names = (re.findall("All User Profile : (.*)\r", netsh_output))
wifi_list = []
if len(profile_names) != 0:
for name in profile_names:wifi_profile = {} profile_info = subprocess.run( ["netsh", "wlan", "show", "profile", name], capture_output=True).stdout.decode() if re.search("Security key : Absent", profile_info): continue else: wifi_profile["ssid"] = name profile_info_pass = subprocess.run( ["netsh", "wlan", "show", "profile", name, "key=clear"], capture_output=True).stdout.decode() password = re.search( "Key Content : (.*)\r", profile_info_pass) if password == None: wifi_profile["password"] = None else: wifi_profile["password"] = password[1] wifi_list.append(wifi_profile)for x in range(len(wifi_list)):
print(wifi_list[x])
#create with Arj#2784`
Hello, this file shows the Wi-Fi password that you have connected
From the first Wi-Fi you connected to now
if im making a game that will have player one be the host, and other players, (one other for now but i may increase this later) do i need to worry about the hosts device ip being sent to whoever connects. and is there a tutorial for this kind of connection.
so far all the tutorials have a server program and client programs, rather than the host device just running the server and that having the client integrated... or is that a dumb idea.
current setup has server which has to be opened, then client program on that same device and then another client from an external device. (which is bad because it sends the data (client program) out of the socket which then just returns though that socket again.(to server program))
i want it to be host (server and client program integrated) opened and then external devices to connect. which means the device hosting does not sent data out just for it to be returned to itself.
- note i may be wrong with how this works lol.
There's nothing necessarily wrong with having the game host simply be a client which connects to a local server, that's the approach quite a few games take, e.g. Minecraft does the same thing (even in singleplayer!)
They work by, when the client program is told to host, opening up a thread/subprocess in the background to run the server-side of the code, and then connecting to the local server
im thinking it could cause added unnessicary delay. because if youre connected over wifi(local network) then youre sending data to the wifi router just to receive that back on the same device. makes sense to just thread to run the client after the server is started.
if you tell the client to connect to localhost, or 127.0.0.1, that's treated as a special local connection that never actually goes outside of your device
so its not actually going through the wifi router at all, and the delay is for all intents and purposes nonexistent
Alright that makes sense
Hi, anybody familiar with uplink (https://uplink.readthedocs.io/en/stable/index.html) package?
Currently I have below code
from uplink import *
class auth_client(Consumer):
@returns.json
@post("auth/access_token")
def get_access_token(self, payload: Body):
pass
The code above could be used like this:
the_client = auth_client(base_url="https://test.example.org/us/")
the_client.get_access_token()
But, I want something like this instead:
the_client = auth_client()
the_client.set_country("eu")
the_client.get_access_token()
The set_country method would then override the base_url subdomain.
(from https://test.example.org/us/ to "https://test.example.org/eu/"
How can I do this?
Thanks!
Anyone have a way of getting the usable ip's based on a subnet? Like say, 10.0.0.1/27 would print out Total:32, Usable:30 Range:10.0.0.1-30 , and then add each IP to a list?
Total = 2^(8-CIDR%8) where CIDR is 27
Usable = total - 2
not sure i should be asking here but here's my problem:
I have a GUI that sends a request every second to an api endpoint to retrieve updated data
whenever I try to start my GUI and after some times, my wifi bars drop from 5 to 1 until I restatrt the program
something I've thought is the response body being too big to handle by my internet, I don't know tho
I just wanna know what causes it and eventually fix it
How do I check if a url starts with a link and contains .mp3 in it and returns it?
Here's what I tried:
import requests
from requests_html import HTMLSession
class Test():
def Test(self, input):
name = input.replace(" ", "_")
l = f"https://example.com/{name}"
r = HTMLSession().get(l).content
if "https://example2.com/" and f"{str(name).title()}.mp3" in r:
# Here's where I was stucked.
/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/ url regex
after finishing request check response content-type
>>> import requests
>>> s = requests.Session()
>>> r = s.get("some-mp3-site")
>>> r
<Response [200]>
>>> r.headers["Content-Type"]
'audio/mpeg'
@ornate turret
hope it helped
Hi, I want to build a live geolocation sharing (only for family use), I m setting up a oracle server for python server socket, do i use async / sync socket server, which protocol would be better for this kind of use TCP or UDP, can you provide me more resource in asyncio.
look at aiohttp.ClientSession.ws_connect()
How's it going guys. I happen to be in need to develop myself a personal/proprietary "cloud" based file storage server for a webapp which is based around storage service. I have to chunk the files and write a file hash. Here's the complicated part, idk how the industry does file storage. I imagine the files are encrypted, chunked and flattened but I don't know what strategies Microsoft or other high end companies use that i could also employ to achive secure and optimised file storage server design
if this is how the industry does file storage, ig i dont have any other questions other than, how should access be provided as this server is seperated from the main api server backend.
Not every server use these methods but yes I say they are probably the most popular
what are the other strategies
Encryption and hash are 2 big ones
well right now, the current physical file storage arch uses folders with are named with keys that are indexed, within, file chunks are freely stored, in which i keep track of chunks with a file hash, alongside ill probably come up with some naming strat to make sure the files are easy to query
thats the issue, idk what the decrypt key should be, i was thinking it would be a 2fa based key, but idk how dynamic encrption would work
i could use the user password hash as a encrypt/decrypt key
All our decryption keys are stored locally in the game files and if a user were to breach the files they would have to first find it and know what they are looking for. And obviously we get people who do this but it requires rooted devices
We have algorithms which automatically use the decryption key to decrypt the files
If you hold the keys
Then government can force you to decrypt
Itโs using many different hashing techniques itโs well protected
Like in cases where FBI /CIA want access
nah i think my countries privacy laws dont allow me to hold keys for more than like 5 days
Thatโs not very often
But yes
but techno, what do you think of using user password hash as the encryption/decryption key
Is a typical practice
I think security as layers
You can have that
well that would be the last layer
the deepest layer
i gotta figure out the outer layers as well, but currently, i gotta figure out access to the last layer rn
Plus extra layers the client side encryption
And the secure SSL tunnels
Only as strong as weakest link
ssl tunnels
Kinda complicated but there are bad actors
i gotta program this now :/
idk if i should write this in python though, working with files, i would need a statically typed language to be more performant right?
Yes as struct
java has alot of file and data indexing tools
should i use c#?
i've been using it recently for wpf
ig it would be a good idea to use a lang which built azure, which is what im trying ot mimic
If you are MS platform
well, im currently just doing web based client
C# clean
also, this server, is only going to communicate with my backend
which is in python,
i should create a diagram
but this server is proprietary, but its standalone to act as a database for physical files and server to serve the files to the backend to be reconstructed and dispatched
Up to you if you can hold lt all in your head no diagram needed but later you might forget so diagram it
its mentally diagrammed
just explaining it could be misinterpreted xD
but yeah, lots of sharp edge to sand down
Kinda a game of telephone
I been discussing startup ideas with someone else and yes it happens
what happens
Ideas aren't grok immediately or misinterpreted
So yeah paper great
At least consensus is written
Neat
damn this is a huge project
Good luck
ig im just anxious about missing out on industry standard functionality
is that a noun? or are they a company
oh cool https://business.gov.au
Connecting you to information, grants, registrations and support to help your business succeed in Australia.
idk about being a start up, my main competitor is google photos
they do lossless file hosting for up to 15 gb free for millions
but ig i've got some neat features that could please some privacy anxious people
Which is great
were all those companies funded by y combinator?
oh yeah
Some apply with idea only
40 percent they say
It's better to apply with POC
And market traction
And revenue
But they don't exclude idea stage
im working towards the PoC, and i've been working on my culpability as an application and its integrity
Y combinator loves huge projects with great potential markets
damn, i literally had no idea who y combinator were
Everyone needs secure file storage
I'm a startup veteran
i can tell, you've been nothing but insightful and helpful
Keep in touch then
mate, you got it
okay well ig i should just stick with python and produce a file digest pipeline for now
i'll get a PoC and let you know how it goes
again, thank you sm for the advice mate, your a god gift
No probs
What does the API docs say?
hi, i have a server that send to client like 10 times data, but i want to the client to print all the data that the server sent (like 10 times data). How i can do that?
but the client only print only 1 time data
no the 10th
summary: My Server send a message but i want to send a second message and I want to receive second message in the client
I'm working on a tool that is mainly used with the command line. It establishes a network connection after being called from the CLI and keeps that network connection running as it shows the CLI GUI. The tool allows to send messages over the network and receive responses. Sometimes, there are messages received that are not expected responses and could be, for example, just for network management/status reasons. What are the best practices to manage network messages with such a tool? For a long while, I thought about having a different thread for network messages but then there's also the problem of IPC. I would appreciate some advice if anyone could help with this!
Hello, I'm not really sure where to ask this, but how do I map an ip address to a domain or perhaps another ip address in windows 10? I've been searching for quite a while and couldn't find an answer, all I found was how to map a domain to an ip address where on the other hand I want to do the opposite.
how do i make a program that can connect via a room system.
ie one user hosts a room, and another can enter a code and connect to that with sockets.
please help me - how to connect an IP camera to python ???
Use its api
Hello, is there any way to control this raise that he throws?
try this:
try:
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((self.data["host"], self.data["port"]))
except (
ConnectionRefusedError,
socket.error,
socks.ProxyConnectionError,
Exception,
) as e:
errorHandler(e, raise_=True)```
But it follows me without taking the exception
errorHandler raises the error?
if you catch it and then reraise it, it's quite obvious, that it's shown to you
I need to add a TCP server to my backend, we're currently running Django on the backend. I was thinking of adding it to Django since it is possible to add it, however since it can be deployed separately and Django is geared towards http requests, I was thinking of using another way, e.g. asyncio or twisted. Any tips/advice? (please @ me when responding/discussing ^^)
I'm trying to add optional reliability to a UDP socket connection. My choices are:
- add my own packet headers with sequence numbers/acks
- add a second TCP socket next alongside the UDP socket, just for the reliable items
the reason im not heading in the TCP socket direction by default, is it seems trickier to manage the connection state of two sockets everywhere than to just have one socket
anyone done anything like this / have a reco?
Twisted has a potentially much higher performance and scalability than asyncio, but is also a little more confusing and complex to setup effectively.
You may also want to take a look at uvloop (link below). It is comparable in performance to twisted but is built upon asyncio and made to be a standalone TCP server.
Thank you!
Anytime !
Using option 1 requires you to manage the state of the connection and track the sequence numbers and ACK messages yourself manually, which is a little complex and annoying.
The second TCP socket means you can take advantage of the built in reliability of the TCP protocol, but you'll need to manage the state of twice as many sockets.
Up to you when it boils down to it. Which would you prefer?
I'm running python on embedded hardware that's pretty weak, ultimately if adding a TCP socket is not too much extra overhead, that's probably going to have less bugs than trying to roll my own on UDP
(pretty weak = 16mb system ram)
each device will only have to have one of these optional-reliability connections
Sounds like it yep. In that case I'd have to agree and recommend the second socket
Hey guys, I'm new in this srvr
So, I am having a Nokia G-140W-F WiFi GPON router, and I want to install OpenWrt on it, but its not supported by OpenWrt, so can someone please tell me how to do that
I even have its serial access with 115200 bps
It has an ECONET MTK7526G SoC or direct name EN7526GT its Clock Freq is 900 MHz. It has 512 Mb of DRAM.
Its a MediaTek Soc, but afterward MediaTek was acquired by EcoNet.
It uses 12V 1.5 A Supply to Power itself
Its default Software Which is made by Nokia X Airtel is very poor, because even in its Serial Access I don't get root access, its login & password are forbidden idk where, and even when I got to know its login & password I was not able to get the root access, because the Password2 Algorithm was not working in the software.
Also I'm using MobaXTerm & Putty for Serial Interface
@long bobcat It's not possible, because openwrt doesn't support ECONET MTK7526G SoC. It just isn't compatible with specific hardware. If you want to use a different operating system on your router, you may want to look for a different router that is supported by openwrt or a different OS. You should make a config backup first though! Just in case
There just isn't a way without some seriously hacky monkeypatching
I would not recommend monkey patching security systems into a router
Yeah that's why I said that it isn't possible
Bro Is there any supportable router, that supports MTK7526 SoC?
Btw, Tq for ur reply
Why bro
What does tq stand for?
Thank You
Where does the q come in
Monkey patching is bad by definition
k
I was using it as a metaphor to basically say it's impossible
I'd like to learn how to set up a peer to peer connection for my application. My application is coded in C. Where should I begin?
socket and selectors modules are interesting for this, you could also look into asyncio
Anyone from India?
To set up a P2P connection for your application in C, you need to Choose a networking library: There are several networking libraries available for C that can be used to set up a P2P connection. Some popular options include sockets, libp2p, and Boost.Asio. You will need to choose a library that meets the requirements and goals of your application. Then design the P2P architecture: You will need to decide on the overall architecture of your P2P network. This will involve deciding on the topology (e.g. mesh, star, etc.), the communication protocol (e.g. TCP, UDP, etc.), and the method of addressing and identifying peers. And finally implement the P2P connection: Once you have chosen a networking library and designed the P2P architecture, you can begin implementing the P2P connection in your C code. This will involve using the functions and APIs provided by the chosen networking library to create sockets, bind to a local port, listen for incoming connections, and connect to other peers.
i got a question, my phone is connected to wifi and i am using usb tethering on my phone to give my laptop internet as wifi is broken there, is there any way i can do port forwarding on my laptop?
That should be an option in your phone's hotspot settings
did chatgpt write this
I am looking for advice on python network libraries to build a standalone tcp server that will communicate with a sql database and iot devices to get back data about them. I am looking for something using async/await syntax, currently looking into using tornado with uvloop. Any advice? Please do @ me
anyone here doing mikrotik and python?
ME
Hi there, Iยดd love to talk about it. Can I DM?
sure
Done
anyone have any recourses/docs for networking modules like py socket & OS
routeros_api
how do i start
Any decent resources on networking in games? I've never done that sort of thing, but I do have some general networking experience
IIRC fisher was working on a websocket based real-time game
Not sure how far along he got but might be worth talking to
You probably will have to
It's sort of a go to for games from what I hear
huh?
You can also take the easy way out with Unity or Unreal Engine which make multiplayer easier
I imagine there's a lot of overhead in websockets for very intensive games
but I may be wrong
I guess it's not huge
I'm not 100% on what the big engines uses for their network stuff
Probably their own protocols I'm guessing
I want to target browser, so not a lot of choice
Oh
C# and C++ might be able to compile to WASM if that's desirable
But if you're just writing your game in JS it's not a far cry (see what I did there?) to throw in web sockets with the rest of the stack as well
I guess there is an alternative, namely HTTP ๐ซ
There's also SSE
Not familiar with that; what is it?
Server-sent events
it's something between websockets and HTTP... basically, the server provides an iterator of events
ptth
Though I'm not sure what advantages/disadvantages it may have over websockets
well, it's a simpler protocol
The disadvantage is that the client cannot push events to the server. Although that can be done with just post requests if the game is simple enough
my parents played DOOM over lan before I was born, so surely modern networks can take a bit of an inefficiency ๐
Based parents
Hello guys can anyone help me udp client/server ipv6
if you're using an Andriod go into the options and make sure the WiFi hotspot is enabled and Share phone network via USB is enabled
thats how i enabled it
i need port forwarding
hello, Happy New 2023 first of all
Does anyone knows how i can get the subnet mask of the machine running the python code
i can get the ip address using "gethostbyname" but i can't find a way of getting the netmask
you'll need to know the interface you want to check on
https://pypi.org/project/netifaces/ might be what you want
or i believe you can accomplish it with built in socket
not exactly python related, but can anyone recommend a good option for NAS ontop of Ubuntu Server running on a Libreboard (Rpi 4 alternative)? I am looking for a good way to take advantage of this 2TB SSD and SBC so I can share directories between machines, you know for python stuff
How would I go about setting up a peer to peer room system (preferbly with sockets).
So a user can open a room and another can enter the corresponding code to enter that same room
import socket
def main():
HOST = ""
PORT = 50007
with socket.socket() as s:
try:
s.connect((HOST, PORT))
print("Connected!")
while True:
cmd = input("[SHELL] >> ")
s.sendall(cmd.encode())
while True:
data = s.recv(1024)
if not data: break
print(data.decode(), end='')
except:
print("Connection failed.")
if __name__ == "__main__":
main()```
someone said it could be blocking but I've tried messing around with that, didn't do anything
recv() will only return an empty response when the other side closes the connection somehow (manually or the connection failed), otherwise it will block until something is sent
block as an it won't receive data anymore?
block as in the function call won't return until more data is received
so the hanging input is just the function waiting for more data so it can return?
yeah, setting the socket to nonblocking causes the socket.recv call to immediately return if there's nothing to be read, but that doesn't help much since input() is also blocking
you're trying to do two blocking operations at once, input() and recv() and multiplexing them in a single thread is tricky
it works without the inner while loop, but then not all data is sent if it's larger than 1024 bytes
or is it bits
bytes
there are a few ways of dealing with this, use multiple threads to allow multiple blocking calls to run "at once" or other one which I recommend first
so instead of using a while True loop, the machine on the other end will have to first send some bytes telling many bytes it's sending
in the same message or different message?
sorry, gimme a moment to write some example code, it's easier to explain with some code
I'm thinking to change up the if not data: break to a different condition
but what does the function return with when there's no more data to send (all data is sent, and now just an extra call)
bytes_sent = int.from_bytes(s.recv(4), byteorder="big")
response = bytearray()
while len(response) < bytes_sent:
data = s.recv(1024)
if not data: break
response.extend(blob)
The important part is that the bytes describing how long the rest of the response is (in bytes) is of known fixed length (in this case, 4). The code can first recv the first 4 bytes (which shouldn't block indefinitely as the other side will at least send 4 bytes), decode that into an integer and then keep calling recv() until the response length matches what's expected
oh I see
this way, your code knows when to stop calling recv()
wouldn't it better to declare the data variable before the while loop?
there's no way to know unless the other side closes the connection, TCP is a streaming protocol so it actually doesn't have the concept of "messages"