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 8013769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:43:20+00:00 2026-06-04T19:43:20+00:00

I want to send a notification (say a string) to subscribers(subscribers ip addresses are

  • 0

I want to send a notification (say a string) to subscribers(subscribers ip addresses are in a database on the server side) by calling another method. when ever I call that method the output becomes error-some.

[WebMethod]
public string GetGroupPath(string emailAddress, string password, string ipAddress)
{
    //SqlDataAdapter dbadapter = null;
    DataSet returnDS = new DataSet();
    string groupName = null;
    string groupPath = null;

    SqlConnection dbconn = new SqlConnection("Server = localhost;Database=server;User ID = admin;Password = password;Trusted_Connection=false;");

    dbconn.Open();

    SqlCommand cmd = new SqlCommand();
    string getGroupName = "select users.groupname from users where emailaddress = "+"'"+ emailAddress+"'"+ " and "+ "users.password = " + "'" +password+"'";
    cmd.CommandText = getGroupName;
    cmd.Connection = dbconn;
    SqlDataReader reader = null;
    try
    {
        reader = cmd.ExecuteReader();
        while (reader.Read())
        {
            groupName = reader["groupname"].ToString();
        }
    }
    catch (Exception)
    {
        groupPath = "Invalied";
    }


    dbconn.Close();
    dbconn.Open();

    if (groupName != null)
    {
        string getPath = "select groups.grouppath from groups where groupname = " + "'" + groupName + "'";
        cmd.CommandText = getPath;
        cmd.Connection = dbconn;

        try
        {
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                groupPath = reader["grouppath"].ToString();
            }
        }
        catch
        {
            groupPath = "Invalied";
        }
    }
    else
        groupPath = "Invalied";
    dbconn.Close();


    if (groupPath != "Invalied") 
    {
        dbconn.Open();
        string getPath = "update users set users.ipaddress = "+"'"+ipAddress+"'"+" where users.emailaddress = " + "'" + emailAddress + "'";
        cmd.CommandText = getPath;
        cmd.Connection = dbconn; 
        cmd.ExecuteNonQuery();
        dbconn.Close();

    }

    NotifyUsers();
    //NotifyUsers nu = new NotifyUsers();
    //List<string> ipList = new List<string>();
    //ipList.Add("192.168.56.1");

    //nu.Notify();

    return groupPath;
}

private void NotifyUsers() 
{
    Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
    byte[] ipb = Encoding.ASCII.GetBytes("255.255.255.255");
    IPAddress ipAddress = new IPAddress(ipb);

    IPEndPoint endPoint = new IPEndPoint(ipAddress, 15000);
    string notification = "new_update";
    byte[] sendBuffer = Encoding.ASCII.GetBytes(notification);
    sock.SendTo(sendBuffer, endPoint);
    sock.Close();  
}

This is what has to be basically done. in the server side I have a listening thread and it gets notification when the server sends data( assume for now the database contains client ip address). then ever I call the web method it gives a error “invalid IPAddress” atline

byte[] ipb = Encoding.ASCII.GetBytes("255.255.255.255");

thank you 🙂 since this is my first ever post please be kind enough to give me a better feedback too 🙂
thaks

  • 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-04T19:43:21+00:00Added an answer on June 4, 2026 at 7:43 pm

    Try the following code in notification, before that disable firewall setup…

    try
    {
        // Establish the remote endpoint for the socket.
    
        // This example uses port 11000 on the local computer.
        IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName())
    
        Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
    
        IPAddress ipAddress = ipHostInfo.AddressList[0];
        IPEndPoint remoteEP = new IPEndPoint(ipAddress,15000);
        string notification = "new_update";
        byte[] sendBuffer = Encoding.ASCII.GetBytes(notification);
        sock.SendTo(sendBuffer, remoteEP );
        sock.Close();  
    }
    catch() {}
    

    Hope this will solve the issue.

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

Sidebar

Related Questions

im want to send notification from my server side (c#) via urbanairship api is
When you setup your push notification server, and want to send a message to
I've events table in Oracle database. I want to send email notification whenever a
I want to send notification from PHP application and same time it should be
I want to send message/notification to friends with customized subject with a link in
Hello Sir i want send list of data to php server i use following
I want to send SQL server Dashboard & Health Report to my client on
I want to send a notification from a UITableViewController-A to UITableViewController-B. I was adding
Whenever an unhandled exception occurs on our site, I want to: Send a notification
I want to send notification message every second from net tcp WCF service to

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.