Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8177587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:32:54+00:00 2026-06-06T23:32:54+00:00

I want connect with my jabber server and read server answer: DnsEndPoint host =

  • 0

I want connect with my jabber server and read server answer:

       DnsEndPoint host = new DnsEndPoint("talk.google.com", 5222);
        Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        SocketAsyncEventArgs args = new SocketAsyncEventArgs();

public void start()
{
 string message = "<?xml version=1.0?><stream:streamto='gmail.com'xmlns='jabber:client'xmlns:stream='http://etherx.jabber.org/streams'version='1.0'>";

            var buffer = Encoding.UTF8.GetBytes(message);

            args.RemoteEndPoint = host;
            args.Completed += SocketAsyncEventArgs_Completed;
            args.SetBuffer(buffer, 0, buffer.Length);

            bool completesAsynchronously = socket.ConnectAsync(args);

            if (!completesAsynchronously)
            {
                SocketAsyncEventArgs_Completed(args.ConnectSocket, args);
            }
}

 private void SocketAsyncEventArgs_Completed(object sender, SocketAsyncEventArgs e)
        {
            if (e.SocketError != SocketError.Success)
            {
                 Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show("Error during socket operation: " + e.SocketError));
                return;
            }
            byte[] buffer = e.Buffer;
            XDocument temp = ConvertByteArrayToXml(buffer);

        }

XDocument ConvertByteArrayToXml(byte[] data)
        {
            XmlReaderSettings settings = new XmlReaderSettings();

            using (MemoryStream stream = new MemoryStream(data))
            using (XmlReader reader = XmlReader.Create(stream, settings))
            {
                return XDocument.Load(reader);
            }
        }

At Return XDocument.Load(reader) I get exeption '1.0' is an unexpected token. The expected token is '"' or '''. How can solve it?

Why I want it? Because when I authorize myself and change status it not affect it at my account.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:32:56+00:00Added an answer on June 6, 2026 at 11:32 pm

    This (in your declaration for message):

    <?xml version=1.0?>
    

    is an invalid XML declaration. As per the exception, you want:

    <?xml version="1.0" ?>
    

    Note that this has nothing to do with Jabber or sockets, and everything to do with XML. It’s important to pay attention to exception messages and stack traces, so you can diagnose this sort of thing for yourself: you need to be able to isolate the area of the problem, so you can tackle just that one bit in isolation.

    (The rest of that XML looks pretty bust, too, by the way.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to connect to a URL with the socket method ( http://msdn.microsoft.com/en-us/library/system.net.sockets.socket(v=VS.96).aspx );
I want to connect to a server socket specified by a destination ip address
I want to connect from home using SQL Server 2005 to another PC. I
In my application I want to connect SQL Server Express with Hibernate. But I
I want to connect to Sql server and running some sql queries. How can
I want to connect to a ldap server with python-ldap using a specific baseDN.
I want to connect from a COBOL/VMS system to an SQL Server 2005 instance.
I want to connect an svn server and download one file to my computer
I want connect to SQL Server Compact 4.0 in my ASP.NET application. Here is
I want to connect up to a database server in my .NET app and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.