Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JID not working #92

Closed
karolstaniek opened this issue Nov 13, 2017 · 8 comments
Closed

JID not working #92

karolstaniek opened this issue Nov 13, 2017 · 8 comments

Comments

@karolstaniek
Copy link

Hi,
I keep getting error on JID:
Did not provide required parameter: \r\nParameter name: jid
I used example code with only parameters changed for connection.

Any ideas what can cause this error?

@ForNeVeR
Copy link
Member

Hello. Could you please clarify, what exact steps are you taking to get that error?

@karolstaniek
Copy link
Author

I basically just changed connection parameters:

JabberClient jc = new JabberClient(); 
            jc.OnReadText += new bedrock.TextHandler(jc_OnReadText); 
            jc.OnWriteText += new bedrock.TextHandler(jc_OnWriteText); 
            jc.OnError +=new bedrock.ExceptionHandler(jc_OnError); 
            jc.OnStreamError += new jabber.protocol.ProtocolHandler(jc_OnStreamError);

            //JID j = new JID(jid);
            jc.User = "myUser";
            jc.Server = "myServer";
            jc.NetworkHost = "myHost";
            jc.Port = 5222;
            jc.Resource = "Jabber.Net Console Client";
            jc.Password = "myPassword";

            jc.AutoReconnect = 3f; 


            GetOpt go = new GetOpt(this); 
            try 
            { 
                go.Process(args); 
            } 
            catch (ArgumentException e) 
            { 
                go.UsageExit(); 
            } 

I'm using Cisco Jabber.

Many thanks in advance

@ForNeVeR
Copy link
Member

Are you running the code from the console example? If so, then what command line arguments are you providing?

It looks like you actually haven't passed the jid command line argument, and it's required in the console example.

Probably you just need to remove go.Process(args) part, if you don't want to process the command line arguments at all.

@karolstaniek
Copy link
Author

karolstaniek commented Nov 13, 2017

alt text

For some reason none of the arguments are passed, when provided at following schema:

        [CommandLine("j", "myUser@myServer", true)] 
        public string jid = null; 


        [CommandLine("p", "myPassword", false)] 
        public string pass = null; 


        [CommandLine("n", "myHost", false)] 
        public string networkHost = null; 


        [CommandLine("o", "Port", false)] 
        public int port = 5222; 

@ForNeVeR
Copy link
Member

How are you passing them?

@karolstaniek
Copy link
Author

        static void Main(string[] args) 
         {
             try
             {
                 new Program(args);
             }
             catch (Exception ex)
             {

             }
             //Thread.Sleep(15000);
         } 

@ForNeVeR
Copy link
Member

ForNeVeR commented Nov 13, 2017

I think you have problem understanding the GetOpt class. It takes the arguments from the command line and places them into the fields jid, pass so on.

Some of the command line arguments are explicitly marked as required = true in the example program (e.g. jid). From your screenshot, it looks like you're passing no arguments to the program. That's the reason GetOpt throws an exception.

It also looks like you think the second argument of CommandLine could define a default value for the argument. It's wrong; the second argument is description; take a look at the source.

To solve your problem, please pass the command line arguments to the program. E.g.

JabberNet.ConsoleClient.exe -j user2@example.com -p password

@ForNeVeR
Copy link
Member

Closing due to a missing response from the original poster. Feel free to discuss and reopen if the issue is still unsolved.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants