Jump to content


Photo

Java - recreation of 39dll


  • Please log in to reply
8 replies to this topic

#1 orange451

orange451

    GMC Member

  • GMC Member
  • 1120 posts
  • Version:GM8.1

Posted 07 February 2012 - 12:40 PM

I've been writing a Library in Java that actslike 39dll (not using the existing 39dll lib [limits you to windows]). This uses Java's naitive Sockets, and works pretty well in my opinion :3

Link


Functions (almost all the same from 39dll):

receivemessage(Socket socket) //returns an int of the size of the buffer
sendmessage(Socket socket) //sends the buffer to a socket (packet)

clearbuffer() //clears the buffer
dumpbuffer() //dumps the buffer into the console

writebyte(byte val) //writes a byte to the buffer (stored as an int in the JVM though)
writeint(int val) //write a 4-byte integer to the buffer
writestring(String str) //writes a string to the buffer (only 1 argument, unlike 39dll).
readbyte() //reads the next byte in the buffer
readstring() //reads a string from the buffer
readint() //reads the next int from the buffer

tcplisten(int port, int maxconnections, int blocking) //returns a ServerSocket (null if none)
tcpaccept(ServerSocket socket, int blocking) //returns a socket of a person connecting to the ServerSocket (null if none)


  • 0

#2 Sir

Sir

    Jedi Poodoo

  • GMC Member
  • 384 posts
  • Version:GM:Studio

Posted 10 February 2012 - 05:57 PM

Sorry for asking, but how am i supposed to use a .jar? Is this for HTML5 or GM 8.1?
  • 0

#3 orange451

orange451

    GMC Member

  • GMC Member
  • 1120 posts
  • Version:GM8.1

Posted 11 February 2012 - 11:49 AM

Sorry for asking, but how am i supposed to use a .jar? Is this for HTML5 or GM 8.1?



You need to know Java. Any version of Game Maker that supports 39dll can have their server written in this library.

Edited by orange451, 11 February 2012 - 11:50 AM.

  • 0

#4 adder_astros

adder_astros

    GMC Member

  • New Member
  • 83 posts
  • Version:GM8

Posted 02 May 2012 - 09:28 PM

I could have use for this... I do have questions, though:

Now, is this a Library that gives Java programs similar Socket connectivity as what 39DLL does (instead of using the setup Java has), or just a multiplatform alternative to 39DLL for the functions listed? Also, is that the complete function list?
  • 0

#5 klek

klek

    GMC Member

  • GMC Member
  • 28 posts
  • Version:GM:Studio

Posted 09 July 2012 - 10:59 PM

Well... i just have the question... how to implement it on a Game Maker? ...
  • 0

#6 klek

klek

    GMC Member

  • GMC Member
  • 28 posts
  • Version:GM:Studio

Posted 09 July 2012 - 11:21 PM

Ok, i understand how to use it, thanks, LOLs

Its for the server, not client!!! LOLs!!!! XD
  • 0

#7 klek

klek

    GMC Member

  • GMC Member
  • 28 posts
  • Version:GM:Studio

Posted 10 July 2012 - 12:55 AM

I tested it and it donst work whit 39Dll
  • 0

#8 klek

klek

    GMC Member

  • GMC Member
  • 28 posts
  • Version:GM:Studio

Posted 11 July 2012 - 08:25 AM

ok, i have to say sorry!

I tested it again and it work like a charm!!

Thanks!! really thanks!!!
  • 0

#9 orange451

orange451

    GMC Member

  • GMC Member
  • 1120 posts
  • Version:GM8.1

Posted 28 August 2012 - 04:55 PM

ok, i have to say sorry!

I tested it again and it work like a charm!!

Thanks!! really thanks!!!


I'll be uploading an updated version of this (fixes that odd bug with only being able to send certain values, it also uses a bufferedoutput stream to ensure your data gets sent properly to the server).
I will also upload an example (open source) to go along with this :)

Until then...
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users