Sockets for Monkey

Monkey Archive Forums/Monkey Projects/Sockets for Monkey

vbnz(Posted 2012) [#1]
Hello, Monkey community!
I have working on sockets library for monkey.
I have already done sockets to one monkey target:
1)HTML5
You can connect to dedicated server,and create your local server using sockets.

I am currently working on android sockets.

Sincerely, vbnz.


Xaron(Posted 2012) [#2]
Great stuff! Looking forward to this! :)


tOmzone(Posted 2012) [#3]
Networking for monkey... Yay great!!


Skn3(Posted 2012) [#4]
Very good stuff! Keep up the awesome efforts!


Qcat(Posted 2012) [#5]
That's fantastic! Can't wait to try it out.


semar(Posted 2012) [#6]
Both thumbs up !


vbnz(Posted 2012) [#7]
Thanks for good comments!
Little update of the theme.
Added flash sockets.

Flash Sockets and Html5 Server:




Sincerely, vbnz.


vbnz(Posted 2012) [#8]
I would be grateful if you(Monkey users) could answer the question:
1)Which network protocols you prefer? TCP or UDP?

Sincerely, vbnz.


Volker(Posted 2012) [#9]
There was a thread in the blitzmax forum a few years ago about this:
http://www.blitzbasic.com/Community/posts.php?topic=57251
The conclusion is: None :-)
I would prefer TCP, because of the reliability.


DruggedBunny(Posted 2012) [#10]

Which network protocols you prefer? TCP or UDP?


Both have different uses, of course, but if I had to choose one it would probably be TCP, just because communicating with servers is probably more useful. I suspect most would prefer UDP though!


semar(Posted 2012) [#11]
Which network protocols you prefer? TCP or UDP?


Well, there are cases where the reliability of TCP is a must; however, the speed you gain with UDP is very important in a fast pace multiplayer scenario.

I would say both, if possible.

Sergio.


Xaron(Posted 2012) [#12]
I'd prefer TCP first but both should be in.

BTW: Thanks for doing this. I've started working on this as well but will now concentrate on Bluetooth first if you do the sockets part. :)


Skn3(Posted 2012) [#13]
Agree with the "both" statement. It would be nice however if the protocol was abstracted so we could extend with additional "drivers"?

For example I wrote html5/flash module for the pubnub service: http://monkeycoder.co.nz/Community/posts.php?topic=2397

It would be great to be able to write a pubnub driver that could be slotted into your sockets api. It most definitely is not an essential feature, but just food for thought.

Keep it up!


DruggedBunny(Posted 2012) [#14]
Don't get me wrong, both would be ideal... I just assumed vbnz was asking about one protocol or the other for a reason!


Tibit(Posted 2012) [#15]
This is great!

I'll soon need networking, would be awesome to have a solution that works across platforms.

Games like DrawSomething in my oppinion shows that multiplayer is where it's at! :)

My suggestion is to start with TCP - make just sending data possible first. Most games can be made with TCP. World of Warcraft is TCP-based, and when we talk mobiles or web, you need to design with latency in mind - and then TCP makes just as much sense for the majority of games.

btw UDP is not faster than TCP, it just use a buffering approach not optimal for action games when you have high latency.

TCP requires some extra work since it is a Stream and you might want to "chunk" up the incoming data into packages since that makes a lot of sense in games.

UDP is simpler at first, however to get reliable UDP that is optimized for action games a lot programming is requried (done that several times, always takes longer time than I expect)

The absolut basics. Bare bones sockets are all I would need to start implementing reliable UDP for example - since I have done that before.

vbnz, would you like to work together a bit? Please send me an e-mail. patrik.strandell@... :)


vbnz(Posted 2012) [#16]
Volker,DruggedBunny,semar,Skn3,Tibit,Xaron Thank you!
I,too, more like TCP protocol.
I have already done:
1)HTML5 TCP,UDP
Client,Server Sockets
2)Flash TCP
Client Sockets
3)Android TCP

Xaron,how I can contact with you?

Tibit,ok I will send you email.

Sincerely, vbnz.


Tibit(Posted 2012) [#17]
Great! Should we get the project on Google? http://code.google.com/hosting/createProject

I'm excited to get started :)

I did check out: http://www.pubnub.com/ it looks killer too. I do kinda like that they take care of the server side of things. Yet I'd also love to be able to write my own server (client also) and use that code crossplatform using monkey - that would just be so awesome! And with sockets that would (to a large extent) be very possible.


Xaron(Posted 2012) [#18]
Tibit, vbnz, no need to create a new project in my opinion. I already created MNet some time ago and would add you two as authors if you don't mind:

http://code.google.com/p/mnet/

I still have some interface cleanup stuff I'd like to checkin, will do that later! Plus MNet is already in the mods section on this site!

My mail address: martin.leidel@...

MNet is and will remain open source! I will continue with the Bluetooth stuff!

Cheers - Martin


Xaron(Posted 2012) [#19]
Alright. Interface cleanup has been checked in. :) I'll continue with my Bluetooth stuff now.

Drop me a mail please! :)

@vbnz: Alternatively you can send me your code and I'll integrate it into MNet if it's too much effort for you!

@Tibit: I've already added you to that Google project. If you don't like, please let me know. ;) I think we can work together and create something really great!


semar(Posted 2012) [#20]
It's just.. freaking awesome.

Keep on guys - it's amazing what you all are bringing into monkey :)

Regards,
Sergio


vbnz(Posted 2012) [#21]
Xaron,Tibit I sent email to you!


Skn3(Posted 2012) [#22]
Just as an idea, what about "MonkeySocks" as a project name ;P


Tibit(Posted 2012) [#23]
@Xaron - oh I did not know. I never got a notification, or maybe it got into the spam folder? So I thought you abandoned it. Well well :)

Yes, of course we should use MNet, my misstake Xaron! Sorry :)


Tibit(Posted 2012) [#24]
Skn3, can we add your PubNub to the project? I'd like to use PubNub for some applications - it gets you going with server side stuff really fast :)


Xaron(Posted 2012) [#25]
Hmm... it's not free, is it?

http://www.pubnub.com/price

Edit: Oh well. Up to 1 mio. messages per months are free. What does "message" mean here?

Edit2: On a closer look this is definitely worth a try. I will try to add this to MNet for Android and iOS.

Edit3: Wow. :D Well, I'll definitely add this to MNet. :) Shouldn't be too hard! Thanks for that, how could I miss that gem?


Skn3(Posted 2012) [#26]
Yes please do add it to whatever you like. I was hoping someone would find the time to finish it :)

[edit] and as in the other thread message is both ways. Person posts a message to channel "lobby" = 1 message. Each person subscribed to channel "lobby" receives the message = additional messages. so if there are 5 people subscribed then the total would be 6 messages used.


Xaron(Posted 2012) [#27]
Alright,thanks for that. Will start working on the Android port now followed by iPhone.


Tibit(Posted 2012) [#28]
Awesome! :)


Aman(Posted 2012) [#29]
Sounds great. If you need help with Android port I will be happy to work with you guys.

@Xaron: can't wait to see bluetooth supported on monkey. Finally, will be able to have multiplayers functionality in monkey.