How can I send some udp via python to a web domain?How can I represent an 'Enum' in Python?How to control web page caching, across all browsers?How do I copy a file in Python?How can I safely create a nested directory in Python?How can I remove a trailing newline in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?

How to write a 12-bar blues melody

Can you Ready a Bard spell to release it after using Battle Magic?

Should I mention being denied entry to UK due to a confusion in my Visa and Ticket bookings?

What does "Managed by Windows" do in the Power options for network connection?

How to adjust tikz picture so it fits to current size of a table cell?

Can there be a single technologically advanced nation, in a continent full of non-technologically advanced nations?

Can my company stop me from working overtime?

US born but as a child of foreign diplomat

Should I dumb down my writing in a foreign country?

What does 'made on' mean here?

Adding command shortcuts to bin

Will 700 more planes a day fly because of the Heathrow expansion?

Decoupling cap routing on a 4 layer PCB

Where can I go to avoid planes overhead?

Identifying characters

How should I tell my manager I'm not paying for an optional after work event I'm not going to?

How to use dependency injection and avoid temporal coupling?

What does this wavy downward arrow preceding a piano chord mean?

Why do people keep telling me that I am a bad photographer?

Has a commercial or military jet bi-plane ever been manufactured?

Are Finitely generated modules over a ring also finitely generated over a subring containing the identity?

Why does this derived table improve performance?

My advisor talks about me to his colleague

Emotional immaturity of comic-book version of superhero Shazam



How can I send some udp via python to a web domain?


How can I represent an 'Enum' in Python?How to control web page caching, across all browsers?How do I copy a file in Python?How can I safely create a nested directory in Python?How can I remove a trailing newline in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















So currently I am trying to send udp to a server with a web domain like this
www.example.com/path?stuff=exist
I am currently trying to use socket
and this is is an example of my code



import socket

IPADDR = '64.233.177.139'

that is the ip of google, and not the ip I am currently trying to send to

PORTNUM = 9001

PACKETDATA = '42["message","test"]'

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
s.connect((IPADDR, PORTNUM, '/path?stuff=exist'))
s.send(PACKETDATA)`


And I currently get this error
TypeError: getsockaddrarg() takes exactly 2 arguments (3 given)



I am new to using the socket library and did some digging to no avail.



For some more context I just want to send the data in PACKETDATA to the server google.com/path?stuff=exist (not really that url, just an example)
Anything helps, thanks in advance.










share|improve this question






























    0















    So currently I am trying to send udp to a server with a web domain like this
    www.example.com/path?stuff=exist
    I am currently trying to use socket
    and this is is an example of my code



    import socket

    IPADDR = '64.233.177.139'

    that is the ip of google, and not the ip I am currently trying to send to

    PORTNUM = 9001

    PACKETDATA = '42["message","test"]'

    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
    s.connect((IPADDR, PORTNUM, '/path?stuff=exist'))
    s.send(PACKETDATA)`


    And I currently get this error
    TypeError: getsockaddrarg() takes exactly 2 arguments (3 given)



    I am new to using the socket library and did some digging to no avail.



    For some more context I just want to send the data in PACKETDATA to the server google.com/path?stuff=exist (not really that url, just an example)
    Anything helps, thanks in advance.










    share|improve this question


























      0












      0








      0








      So currently I am trying to send udp to a server with a web domain like this
      www.example.com/path?stuff=exist
      I am currently trying to use socket
      and this is is an example of my code



      import socket

      IPADDR = '64.233.177.139'

      that is the ip of google, and not the ip I am currently trying to send to

      PORTNUM = 9001

      PACKETDATA = '42["message","test"]'

      s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
      s.connect((IPADDR, PORTNUM, '/path?stuff=exist'))
      s.send(PACKETDATA)`


      And I currently get this error
      TypeError: getsockaddrarg() takes exactly 2 arguments (3 given)



      I am new to using the socket library and did some digging to no avail.



      For some more context I just want to send the data in PACKETDATA to the server google.com/path?stuff=exist (not really that url, just an example)
      Anything helps, thanks in advance.










      share|improve this question
















      So currently I am trying to send udp to a server with a web domain like this
      www.example.com/path?stuff=exist
      I am currently trying to use socket
      and this is is an example of my code



      import socket

      IPADDR = '64.233.177.139'

      that is the ip of google, and not the ip I am currently trying to send to

      PORTNUM = 9001

      PACKETDATA = '42["message","test"]'

      s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
      s.connect((IPADDR, PORTNUM, '/path?stuff=exist'))
      s.send(PACKETDATA)`


      And I currently get this error
      TypeError: getsockaddrarg() takes exactly 2 arguments (3 given)



      I am new to using the socket library and did some digging to no avail.



      For some more context I just want to send the data in PACKETDATA to the server google.com/path?stuff=exist (not really that url, just an example)
      Anything helps, thanks in advance.







      python http udp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 0:00









      nacho

      3,02811326




      3,02811326










      asked Mar 22 at 23:58









      Garrett WeberGarrett Weber

      33




      33






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Your immediate programming problem is that socket.connect expects to be called with an argument that is a tuple containing exactly two items -- a hostname (or IP address) string and a port number. But this program passes an argument tuple that contains 3 items -- a host address, a port number and the string '/path?stuff=exist'. That's why the error message complains about finding 3 things where only 2 were expected.



          If you want to send '/path?stuff=exist' over UDP then you'll have to include it in the data portion of the datagram. You'll also have to come up with some way of making it distinguishable from the PACKETDATA that you're already putting into the datagram body. (That doesn't need to be fancy. You could just insert a space between the path string and the PACKETDATA.)



          There might also be a conceptual problem here. A web server only listens for TCP traffic. It does not listen for UDP traffic. So unless you've arranged for your specific server to have some sort of listener accepting datagrams on the target UDP port, nothing at the server side will collect this traffic even after you've figured out how to get Python to send it.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55309239%2fhow-can-i-send-some-udp-via-python-to-a-web-domain%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Your immediate programming problem is that socket.connect expects to be called with an argument that is a tuple containing exactly two items -- a hostname (or IP address) string and a port number. But this program passes an argument tuple that contains 3 items -- a host address, a port number and the string '/path?stuff=exist'. That's why the error message complains about finding 3 things where only 2 were expected.



            If you want to send '/path?stuff=exist' over UDP then you'll have to include it in the data portion of the datagram. You'll also have to come up with some way of making it distinguishable from the PACKETDATA that you're already putting into the datagram body. (That doesn't need to be fancy. You could just insert a space between the path string and the PACKETDATA.)



            There might also be a conceptual problem here. A web server only listens for TCP traffic. It does not listen for UDP traffic. So unless you've arranged for your specific server to have some sort of listener accepting datagrams on the target UDP port, nothing at the server side will collect this traffic even after you've figured out how to get Python to send it.






            share|improve this answer



























              0














              Your immediate programming problem is that socket.connect expects to be called with an argument that is a tuple containing exactly two items -- a hostname (or IP address) string and a port number. But this program passes an argument tuple that contains 3 items -- a host address, a port number and the string '/path?stuff=exist'. That's why the error message complains about finding 3 things where only 2 were expected.



              If you want to send '/path?stuff=exist' over UDP then you'll have to include it in the data portion of the datagram. You'll also have to come up with some way of making it distinguishable from the PACKETDATA that you're already putting into the datagram body. (That doesn't need to be fancy. You could just insert a space between the path string and the PACKETDATA.)



              There might also be a conceptual problem here. A web server only listens for TCP traffic. It does not listen for UDP traffic. So unless you've arranged for your specific server to have some sort of listener accepting datagrams on the target UDP port, nothing at the server side will collect this traffic even after you've figured out how to get Python to send it.






              share|improve this answer

























                0












                0








                0







                Your immediate programming problem is that socket.connect expects to be called with an argument that is a tuple containing exactly two items -- a hostname (or IP address) string and a port number. But this program passes an argument tuple that contains 3 items -- a host address, a port number and the string '/path?stuff=exist'. That's why the error message complains about finding 3 things where only 2 were expected.



                If you want to send '/path?stuff=exist' over UDP then you'll have to include it in the data portion of the datagram. You'll also have to come up with some way of making it distinguishable from the PACKETDATA that you're already putting into the datagram body. (That doesn't need to be fancy. You could just insert a space between the path string and the PACKETDATA.)



                There might also be a conceptual problem here. A web server only listens for TCP traffic. It does not listen for UDP traffic. So unless you've arranged for your specific server to have some sort of listener accepting datagrams on the target UDP port, nothing at the server side will collect this traffic even after you've figured out how to get Python to send it.






                share|improve this answer













                Your immediate programming problem is that socket.connect expects to be called with an argument that is a tuple containing exactly two items -- a hostname (or IP address) string and a port number. But this program passes an argument tuple that contains 3 items -- a host address, a port number and the string '/path?stuff=exist'. That's why the error message complains about finding 3 things where only 2 were expected.



                If you want to send '/path?stuff=exist' over UDP then you'll have to include it in the data portion of the datagram. You'll also have to come up with some way of making it distinguishable from the PACKETDATA that you're already putting into the datagram body. (That doesn't need to be fancy. You could just insert a space between the path string and the PACKETDATA.)



                There might also be a conceptual problem here. A web server only listens for TCP traffic. It does not listen for UDP traffic. So unless you've arranged for your specific server to have some sort of listener accepting datagrams on the target UDP port, nothing at the server side will collect this traffic even after you've figured out how to get Python to send it.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 20:29









                ottomeisterottomeister

                3,14221520




                3,14221520





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55309239%2fhow-can-i-send-some-udp-via-python-to-a-web-domain%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript