Browse Source

xcode demo project update

pull/1/head
Joseph Henry 10 years ago
parent
commit
642f5d69fc
  1. 24
      integrations/apple/example_app/OSX/Example_OSX_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  2. 10
      integrations/apple/example_app/OSX/Example_OSX_App/ViewController.swift
  3. 6
      src/SDK_ServiceSetup.cpp
  4. 3
      tests/tcp_client.c

24
integrations/apple/example_app/OSX/Example_OSX_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@ -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>

10
integrations/apple/example_app/OSX/Example_OSX_App/ViewController.swift

@ -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")

6
src/SDK_ServiceSetup.cpp

@ -267,8 +267,10 @@ 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) {
zt_init_rpc(localHomeDir.c_str(), rpcNWID.c_str());

3
tests/tcp_client.c

@ -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;
}

Loading…
Cancel
Save