You are here: MessengerYouLike.IMSDK > Tutorials > Initialize IMClient > Start Listening
MessengerYouLike
Start Listening

First Step is to Set the properties of the IMClient Component and then start the Component to Listen on the sepcifed port and then user can login and perform other operations

  1. Add the IMClient component to a new form. For instructions on how to do this see Adding A Component As A Reference Within Visual Studio .NET 2005

 

 

  1. Set the properties of the component,below is some code which does that

 

[Visual Basic]
        'URL of the IM Server
        IMC.ServerUrl = "http://YourServer.com/IMSDemo/IMServer.aspx"

        'Secret Key to Encrypt and Decrypt all textual messages
        'This should be same in IMServer , if different no communication will take place
        IMC.SecretKey = "ABC1234"

        'Set the Port on which MessengerYouLike Will listen
        IMC.PortToListen = 20145

        'This is to set the Connection Speed on which File Transfer Should be transferred
        IMC.FileConnectionSpeed = MessengerYouLike.IMSDK.IMClient.ConnectionSpeed.Broadband

        'Wether File Transfers will be encrypted or not
        IMC.FileEncryption = True

        'If file encryption is set to true then set the key
        IMC.FileEncryptionKey = "Fil9804"

        'Maximum Friends Allowed for each user in there Contacts list
        IMC.MAXFriends = 100

        'Maximum Groups Allowed for each user in there Contacts list
        IMC.MAXGroups = 10

        'if Friends are not assigned to any group then all
        'friends fall under this group and name of group is set below
        IMC.NameofGroupWithOutAnyGroup = "With Out Group"

        'All Receive files will be saved to this location
        IMC.DefaultFileSavePath = Application.StartupPath & "\IMFiles"

        'Port to use when Listen for files
        IMC.DefaultFileTransferPort = 25301

        'All Display Pictures of friends will be stored here
        IMC.DisplayPicturesSavePath = Application.StartupPath & "\IMDisplayPictures"

 

 

3. Once These properties are set you can now call the Listen Sub , this is a Asynchronous Method, once this sub completes a event IMSDK.IMClient.OnListening is fired. 

 

[Visual Basic]

'Let the Messenger listen ,this should be called before any sub

IMC.Listen()

Private Sub IMC_OnListening(ByVal IP As System.Net.IPAddress, ByVal Port As Integer) Handles IMC.OnListening
      Debug.WriteLine("IMClient Listening on :" & IP.ToString & ":" & Port, True)
End Sub
You are here: MessengerYouLike.IMSDK > Tutorials > Initialize IMClient > Start Listening
Copyright (c) 2007. All rights reserved.