Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,39 @@ SCS - TCP Server/Client Communication and RMI Framework
You can download SCS binaries and source codes directly from here (Github).

If you're using Visual Studio, you can get from Nuget (https://www.nuget.org/packages/SCS).

Integration with other languages:
JAVA:

Creatinng text msg fur scsTextMessage:
private static void WriteInt32(byte[] buffer, int startIndex, int number)
{
buffer[startIndex] = (byte)((number >> 24) & 0xFF);
buffer[startIndex + 1] = (byte)((number >> 16) & 0xFF);
buffer[startIndex + 2] = (byte)((number >> 8) & 0xFF);
buffer[startIndex + 3] = (byte)((number) & 0xFF);
}


public static byte[] GetBytes(String message) throws UnsupportedEncodingException {

byte[] serializedMessage = message.getBytes("UTF-8");


int messageLength = serializedMessage.length;


//Create a byte array including the length of the message (4 bytes) and serialized message content
byte[] bytes = new byte[messageLength + 4];
WriteInt32(bytes, 0, messageLength);
System.arraycopy(serializedMessage, 0, bytes, 4, messageLength);


return bytes;
}

Usage:
String str = "some text\n";
byte[] b = GetBytes(str);
DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
outToServer.write(b, 0, b.length);