LoginToFileServer

Logs an object in to the server

Local Servers:blocking
Remote Servers:blocking
Classification:3.x, 4.x, 5.x, 6.x
Service:Server-Based Connection

Syntax

  #include <nwconn.h>  
   
  int LoginToFileServer (  
     char   *objectName,  
     WORD   objectType,  
     char   *objectPassword); 
  

Parameters

objectName
(IN) Specifies the string containing the Bindery name of the object to be logged in (maximum 48 characters, including the NULL terminator).

A server name can be supplied as part of the objectName: serverName/ objectName

objectType
(IN) Specifies the Bindery type of the object to be logged in (OT_USER, OT_USER_GROUP, OT_PRINT_SERVER)
objectPassword
(IN) Specifies the string containing the object’s password (maximum 128 characters, including the NULL terminator).

Return Values

The following table lists return values and descriptions.

Value

Hex

Name

0

(0x00)

SUCCESSFUL

NetWare Error

EFAILURE

Remarks

If a server name is supplied as part of the objectName, an attempt is made to log in to the specified server. If successful, the new server is assigned a file server ID. The file server ID is made the current file server number, and the connection number on the new server is made the current connection. Any logins using LoginToFileServer without specifying a new server name result in a login to the current server. If the login is not to the current server, the current working volume and current working path are set to the root.

To determine the connection number assigned to the NLM as a result of calling the LoginToFileServer function, an NLM can call GetCurrentConnection (defined in nwcntask.h) or GetConnectionNumber.

NOTE:LoginToFileServer establishes a single connection to the specified server. However, LogoutFromFileServer logs out all the connections to the specified server. You can use LogoutObject to log out a single connection.

See Also

LoginObject, Logout, LogoutFromFileServer, LogoutObject

LoginToFileServer Example

  #include <stdio.h>  
  #include <stdlib.h>  
  #include <nwconn.h>  
   
  main()  
  {  
     int   c;  
     if(LoginToFileServer("supervisor",OT_USER,""))  
     {  
        printf("could not login\r\n");  
        getch();  
        return 1;  
     }  
     c = GetCurrentConnection();  
     printf("current connection: %d\r\n",c);  
     getch();  
     LogoutObject(c);  
     printf("logout performed\r\n");  
     getch();  
     ReturnConnection(c);             /* Only need to return connection  
                                         if logged into local server */  
     printf("connection returned\r\n");  
  }