Commits

Martin Gergov committed 3e82715

When using write with a client no need to write the address over and over.

  • Participants
  • Parent commits fb3436d

Comments (0)

Files changed (2)

File tests/test_top_api.py

     def test_udp_handling(self):
         p = reactor.listenUDP(5000, Echo())
         p.stopListening()
+
+    def test_udt_conversation(self):
+        #FIXME learn how to test transport protocols
+        srv = reactor.listenUDT(6000, Echo())
+        echo = Echo()
+        client = reactor.connectUDT("127.0.0.1", 6000, echo)
+        echo.transport.write("hello")
+        srv.stopListening()
+        client.stopListening()

File udt4twisted/udt.py

         @param addr: A tuple of (I{stringified dotted-quad IP address},
             I{integer port number}); can be C{None} in connected mode.
         """
-        assert addr != None
-        if not addr[0].replace(".", "").isdigit() and addr[0] != "<broadcast>":
-            warnings.warn("Please only pass IPs to write(), not hostnames",
-                          DeprecationWarning, stacklevel=2)
+        if not self._connectedAddr:
+            assert addr != None
+            if not addr[0].replace(".", "").isdigit() and addr[0] != "<broadcast>":
+                warnings.warn("Please only pass IPs to write(), not hostnames",
+                              DeprecationWarning, stacklevel=2)
         try:
             if self._connectedAddr:
                 self.socket.sendmsg(datagram)