BinMessage: Unexpected end of stream

Hello ,

As I am trying to connect with local relativity server on my system from xcode with DARemoteDataAdapter , Please find the code snippet

rda = DARemoteDataAdapter(targetURL: URL(string: "http://localhost:7099/bin")!)
rda.username = "Administrator"

 @objc func remoteDataAdapterNeedsLogin(_ adapter: DARemoteDataAdapter) -> Bool {
        return rda.login(withUsername: "my user name", password: "password", connectionName: "Tasks")


    }

Here . in connectionName i have provided my schemas name.

In the below function I am geeting exception error
@objc func remoteDataAdapter(_ adapter: DARemoteDataAdapter, requestDidFailWith exception: NSException) {

//Error comes :- ################################

An exception occurred on the server: BinMessage: Unexpected end of stream.
(
	0   CoreFoundation                      0x00000001046e01bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x0000000103c86735 objc_exception_throw + 48
	2   RemObjectsSDK                       0x0000000103357a43 -[ROMessage readFromNSData:] + 0
	3   RemObjectsSDK                       0x000000010336107e -[ROHTTPClientChannel intDispatch:responseMessage:] + 196
	4   RemObjectsSDK                       0x000000010336b555 -[ROClientChannel dispatch:] + 397
	5   DataAbstract                        0x00000001032bda65 -[SimpleLoginService_Proxy Login:::] + 344
	6   DataAbstract                        0x000000010329e22c -[DARemoteDataAdapter loginWithUsername:password:] + 114
	7   DataAbstract                        0x000000010329e0ff -[DARemoteDataAdapter login] + 786
	8   DataAbstract                        0x00000001032a2f6d -[DARemoteDataAdapter clientChannelNeedsLogin:] + 26
	9   RemObjectsSDK                       0x000000010336ba7f __73-[ROClientChannel internalPerformAsynchronousLoginNeededForAsyncRequest:]_block_invoke_2 + 205
	10  libdispatch.dylib                   0x0000000105ce3595 _dispatch_call_block_and_release + 12
	11  libdispatch.dylib                   0x0000000105ce4602 _dispatch_client_callout + 8
	12  libdispatch.dylib                   0x0000000105ce7064 _dispatch_queue_override_invoke + 1028
	13  libdispatch.dylib                   0x0000000105cf500a _dispatch_root_queue_drain + 351
	14  libdispatch.dylib                   0x0000000105cf59af _dispatch_worker_thread2 + 130
	15  libsystem_pthread.dylib             0x00000001060d36ee _pthread_wqthread + 619
	16  libsystem_pthread.dylib             0x00000001060d3415 start_wqthread + 13

//Error Ends :-  ################################

 }

Is anybody have idea about.
Xcode version :- 10.1
Swift version :- 4.x

With server explorer I can view all domain and textconnectioon also. It show Connection is operational.

Hello

Seems you’re using wrong rda.login method.

The one you have to use to logi in to Relativity is

- (BOOL) loginWithString:(nonnull NSString*)loginString ;

Login String parameter expected here conceptually is very close to database connection strings. For Relativity Server it can be composed as

NSString *loginString = [NSString stringWithFormat:@"User=%@;Password=%@;Domain=%@;Schema=%@",
                         userName, password, domain, schema];

Hope that helps

Thanks Antonk,
For the quick reply, I tried the same here is my code snippet:-

rda = DARemoteDataAdapter(targetURL: URL(string: “http://172.16.6.71:7099/bin”)!)
super.init()

    rda.delegate = self
    rda.username = "Administrator"
    rda.password = "Relativity"  //Administrator

@objc func remoteDataAdapterNeedsLogin(_ adapter: DARemoteDataAdapter) → Bool {
// NSString *loginString = [NSString stringWithFormat:@“User=%@;Password=%@;Domain=%@;Schema=%@”,userName, password, domain, schema];
return rda.login(with: “User=Alex;Password=111;Domain=DATutorial;Schema=Tasks”)
}

I am getting the same error again. Can you please see what else I am missing.

rda.login;

and

rda.loginWithString: aConnectionString ;

are completely different methods.

You need to either call correct method in remoteDataAdapterNeedsLogin OR to replace

    rda.username = "Administrator"
    rda.password = "Relativity"  //Administrator

with

    rda.loginString =  “User=Alex;Password=111;Domain=DATutorial;Schema=Tasks”

and call the rda.login; method

Thanks Antonk,
For your help. This solution is working correctly.

For the record, though:

rda.login(with: is loginWithString. Welcome to Swift’s mangling of ObjC’s beautiful APIs :wink: