Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. lotusab12
    3. Topics
    L
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 8
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by lotusab12

    • L

      Problem using Melange in VS2017 C++

      Cineware SDK
      • c++ sdk • • lotusab12
      2
      0
      Votes
      2
      Posts
      952
      Views

      r_giganteR

      Hi Lotuslab12, thanks for reaching out us.

      With regard to your issue, rather than creating a new solution/project, I recommend cloning the provided melange example and adapt it to your needs.
      Starting from scratch could lead to all the needed settings not to be on place and cause your building process to fail.

      Finally, be aware that Melange-related questions should go in the Melange Development category, and to make proper use of tags and Q&A functionality.

      Best, Riccardo

    • L

      How to get mouse drag info from external through Python API?

      Cinema 4D SDK
      • • • lotusab12
      10
      0
      Votes
      10
      Posts
      1.9k
      Views

      L

      @m_adam said in How to get mouse drag info from external through Python API?:

      Hi sorry about the confusion of server.close I was referring to self.sock.close.

      After some tests the main issue with your code is currently recvfrom is blocking, meaning until it receives something all the code is blocked, so TestBreak is never called and the thread never ends.

      So using timeout solve the issue.

      import c4d import socket class A(c4d.threading.C4DThread): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) end = False def Main(self): self.sock.bind(("localhost", 20014)) while True: # use timeout to check for TestBreak() try: self.sock.settimeout(1.0) self.sock.listen(1) conn, addr = self.sock.accept() # connection print('Connection address:' + str(addr)) data = conn.recv(BUFFER_SIZE) if not data: print("Got no data.") break else: print("received data:" + str(data)) print str(data) self._data = str(data) # DO SOMETHING conn.close() # timeout except: if self.TestBreak(): self.sock.close() self.End() return continue self.sock.close() if __name__ == "__main__": threadedServer = A() threadedServer.Start()

      Cheers,
      Maxime.

      Awosome, the whole script works very well now, thanks man, you help me quite a lot! mua~