how do i find my ipv4 using python?
<p>my server copy it if you want! :) 
how do i find my ipv4 using python?
can i you try to keep it real short?</p>

<pre><code>import socket

def Main():
    host = '127.0.0.1'
    port = 5000

    s = socket.socket()
    s.bind((host,port))

    s.listen(1)
    c1, addr1 = s.accept()
    sending = "Connection:" + str(addr1)
    connection = (sending) 
    print(connection)
    s.listen(1)
    c2, addr2 = s.accept()
    sending = "Connection:" + str(addr2)
    connection = (sending)
    print(connection)
    while True:
        data1 = c1.recv(1024).decode('utf-8')
        data2 = c2.recv(1024).decode('utf-8')
        if not data1:                            
            break
        if not data2:
            break
        if data2:
            c1.send(data2.encode('utf-8'))
        if data1:
            c2.send(data1.encode('utf-8'))
    s.close() 

if __name__== '__main__':
    Main() 
</code></pre>

<p>thx for the help i appreciate it!</p>

<p>That's all you need for the local address (returns a string):</p>

<pre><code>socket.gethostbyname(socket.gethostname())
</code></pre>

python python-3.x ipv4