xcode demo project update

This commit is contained in:
Joseph Henry
2016-07-18 14:18:46 -07:00
parent 2552e87af8
commit 642f5d69fc
4 changed files with 28 additions and 15 deletions

View File

@@ -54,7 +54,7 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Example_OSX_App/ViewController.swift"
@@ -74,11 +74,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Example_OSX_App/ViewController.swift"
timestampString = "489624182.476645"
timestampString = "490569101.315649"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "182"
endingLineNumber = "182"
startingLineNumber = "181"
endingLineNumber = "181"
landmarkName = "UI_ReadData(_:)"
landmarkType = "5">
</BreakpointContent>
@@ -99,5 +99,21 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Example_OSX_App/ViewController.swift"
timestampString = "490569259.570714"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "180"
endingLineNumber = "180"
landmarkName = "UI_ReadData(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@@ -23,8 +23,8 @@ class ViewController: NSViewController {
@IBOutlet weak var txtTX: NSTextField!
@IBOutlet weak var txtRX: NSTextField!
var serverPort:Int32 = 8081
var serverAddr:String = "10.9.9.203"
var serverPort:Int32 = 8080
var serverAddr:String = "0.0.0.0"
var sock:Int32 = -1
var accepted_sock:Int32 = -1
@@ -166,7 +166,6 @@ class ViewController: NSViewController {
@IBOutlet weak var btnReadData: NSButton!
@IBAction func UI_ReadData(sender: AnyObject) {
// Use ordinary read/write calls on ZeroTier socket
// TCP
if(selectedProtocol == SOCK_STREAM)
{
@@ -175,9 +174,7 @@ class ViewController: NSViewController {
//let str = "Welcome to the machine"
print("strlen = %d\n", str.characters.count)
let encodedDataArray = [UInt8](str.utf8)
// read(accepted_sock, UnsafeMutablePointer<Void>([txtTX.stringValue]), 128);
read(accepted_sock, &buffer, 100);
read(accepted_sock, &buffer, 4);
print(buffer)
}
@@ -226,7 +223,6 @@ class ViewController: NSViewController {
var service_thread : NSThread!
func ztnc_start_service() {
// If you plan on using SOCKS Proxy, you don't need to initialize the RPC
//start_service("/Users/Joseph/utest3")

View File

@@ -267,7 +267,9 @@ void zt_init_rpc(const char * path, const char * nwid);
#endif
//chdir(current_dir); // Return to previous current working directory (at the request of Unity3D)
Debug("Starting service...\n");
#if defined(__UNITY_3D__)
Debug("Starting service...\n");
#endif
// Initialize RPC
if(rpcEnabled) {

View File

@@ -34,13 +34,12 @@ int main(int argc , char *argv[])
}
printf("connected\n");
char *msg = "welcome to the machine!";
while(1) {
printf("enter message : ");
scanf("%s" , message);
// TX
if(send(sock, msg, sizeof(msg), 0) < 0) {
if(send(sock, message, strlen(message), 0) < 0) {
printf("send failed");
return 1;
}