Unable to connect Remote server

MMS library for .NET

Moderator: alt

Post Reply
Sagar
Posts: 1
Joined: Wed Sep 04, 2013 6:30 am

Unable to connect Remote server

Post by Sagar » Wed Sep 04, 2013 6:41 am

Hi

This is my code

private void bSend_Click(object sender, EventArgs e)
{
if (tbUrl.Text.Trim().Length == 0)
{
MessageBox.Show("Please specify MMSC url.");
return;
}

string filePath = Path.Combine(GetCurrentDirectory(), tbMMSFilePath.Text);
if (!File.Exists(filePath))
{
MessageBox.Show("Please specify correct MMS file path.");
return;
}


// Read MMS Message from file
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
MMSMessage mes = MMSMessage.Decode(fs);
fs.Close();

// Change recipient
mes.Header.To = tbTo.Text.Trim() + "/TYPE=PLMN";

// Use proxy if it is specified
if (tbProxy.Text.Trim().Length > 0)
{
System.Net.WebProxy proxyObject = new System.Net.WebProxy(tbProxy.Text);
WebRequest.DefaultWebProxy = proxyObject;
}
else
{
WebRequest.DefaultWebProxy = null;
}

// Prepare MMS client
MM7Client client = new MM7Client(tbUrl.Text);
//please specify MM7 version required for MMSC
client.MM7Version = "6.8.0";
client.AuthId = tbAuthId.Text;
client.AuthSecret = tbAuthPw.Text;
client.VASPID = tbVASPID.Text;
client.VASID = tbVASID.Text;
client.SenderAddress = tbSenderAddress.Text;
client.ServiceCode = tbServiceCode.Text;

try
{
// Submit MMS Message as VASP
SubmitResponse resp = client.Submit(mes);
// or Deliver MMS Message as MMSC
// DeliverResponse resp = client.Deliver(mes);
// Check response status
if (resp.Status.StatusCode == "1000")
{
MessageBox.Show(
"MMS message has been sent successully",
"Server response",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (MM7Exception ex)
{
MessageBox.Show(
ex.Message + Environment.NewLine +
ex.Status.Details,
"Server response error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (WebException ex)
{
MessageBox.Show(
ex.Message,
"Server connection error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}

}


When I click send MMS button at the following line
SubmitResponse resp = client.Submit(mes);

It's getting an exception

catch (WebException ex)
ex =Unable to connect remote server

Any Solution?
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Unable to connect Remote server

Post by alt » Thu Sep 12, 2013 7:17 am

Please ask MMSC if your IP address is allowed on their firewall. Also please check if proxy settings are correct for your network.
Post Reply