Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Kourosh · Dec 17, 2010 at 03:26 PM · networkdataudpstreamtcp

How to receive streaming data over a UDP connection?

First of all, I wonder how do we define that our connection is a UDP and not TCP? Second, In unity3d, i want to receive a string data being streamed over a local connection sent by another software (it's not a unity app)

I tried the OnSerializeNetworkView function, but it doesn't work, cause simply BitStream does not support string values.

here is the code:

var listenPort = 25000; var newMsg:char;

function Start(){ StartServer(); }

function StartServer () { Network.InitializeServer(1, listenPort); }

function OnServerInitialized() { Debug.Log("Server is running"); }

function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo) { var newData: char; stream.Serialize(newData); newMsg = newData; print(newMsg.ToString()); }

could someone turn the lights on :)

lot of thanks,

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by VenomousDevelopment · Jun 15, 2011 at 03:58 AM

You need to write a dll that contains the Javascript code necessary for defining your connections. You will then need to extend that code in your Unity Script so that you can access the class or however you choose to do it. A simple google search should find you an example of a Javascript UDP client and server application. Then you simply modify it for use in your game. http://www.codingfriends.com/index.php/2010/03/31/udp-client/ This has the Javascript code for connecting through a UDP Socket. I realize this thread is very old but I saw the large number of views and no replies. It was similar enough to my question that I felt like answering it. Hope this is of any use to someone.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How can I write to a socket accepted from a tcp listener? 1 Answer

Send Data from one Unity Build, to another Unity Build 0 Answers

How do I identify if the packet arrived by UDP or TCP protocol 1 Answer

Send RenderTexture via TCP or UDP 4 Answers

What is UDP port 52326 used for? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges