الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

سؤال عن كيفية تبادل ملفات بين الكومبيوتر و الجهاز المحمول

مغلق
بدأه neron في 19 فبراير 2008 · 1 رد · 1,395 مشاهدة · في برمجة الأجهزة الكفية والمحمولة بالدوت نيت
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

أرجو المساعدة بطريقة أستطيع جعل تطبيقي على pocket pc يستطيع ارسال ملفات (xml) الى كومبيوتر عبر الانترنت

لقد حاولت استخدام web service فتبين بأنني بحاجة ل static ip للكومبيوتر (والله أعلم)

والمشكلة ان الكومبيوتر ليس لديه static ip .

فأرجو المساعدة بطريقة من أجل ارسال المفات عبر الانترنت وشكرا

#2

<h2 class="r"></h2>HttpWebRequest Class (System.Net)

HttpWebResponse Class (System.Net)<h2 class="r"></h2>

using System;
 using System.IO;
 using System.Net;
 using System.Web;
 using System.Xml;
 using System.Data;
 using System.Text;
 using System.Drawing;
 using System.Collections;
 using System.Windows.Forms;
 using System.ComponentModel;
 using System.Collections.Generic;

 namespace Aeabteam_ReadFromURL
 {
		 public partial class Form1 : Form
		 {
				 public static String ReadFromURL(string url)
				 {
						 string result = string.Empty;

						 // data to be sent						
						 StringBuilder postData = new StringBuilder();

						 StringBuilder Text12 = new StringBuilder();
						 postData.Append("entity = " + "Ben_Laiid");
						 postData.Append("&Data = " + HttpUtility.UrlEncode("Message to be sent"));


						 byte[] data1 = ASCIIEncoding.ASCII.GetBytes(postData.ToString());
						 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

						 // Add the required headers					   
						  webRequest.Method = "POST";
						 webRequest.ContentType = "application/x-www-form-urlencoded";

						 // Since we are sending data , specify the content and write to the stream			   
					   webRequest.ContentLength = data1.Length;
						 Stream newStream = webRequest.GetRequestStream();

						 // Send the data.				   
						 newStream.Write(data1 , 0 , data1.Length);
						 newStream.Close();
						 // Retrieve the response
						 HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();

						 System.IO.Stream stream = webResponse.GetResponseStream();
						 System.Text.Encoding ec = System.Text.Encoding.GetEncoding("utf-8");
						 System.IO.StreamReader reader = new System.IO.StreamReader(stream , ec);

						 char[] chars = new Char[2048];
						 int count = reader.Read(chars , 0 , 2048);

						 // read ans store lines from the page				   
						   while (count > 0)
						 {
								 string str = new String(chars , 0 , count);
								 result = result + str;
								 count = reader.Read(chars , 0 , 2048);
						 }

						 reader.Close();
						 return result;
				 }
				 //--------			 
					  public string urlencoder(String str)
				 {
						 str = str.Replace(" % " , " % 25");
						 str = str.Replace("/" , " % 2F");
						 str = str.Replace(":" , " % 3a");
						 str = str.Replace("#" , " % 23");
						 str = str.Replace("&" , " % 24");
						 str = str.Replace(" = " , " % 3d");
						 str = str.Replace(" + " , " % 2b");
						 str = str.Replace("$" , " % 26");
						 str = str.Replace(" , " , " % 2c");
						 str = str.Replace(" " , " + "); //or % 20			   
						 str = str.Replace(" < " , " % 3c");
						 str = str.Replace(" > " , " % 3e");
						 str = str.Replace("~" , " % 7e");
						 str = str.Replace("\"" , " % 22");
						 str = str.Replace("?" , " % 3f");
						 str = str.Replace(";" , " % 3b");
						 str = str.Replace("\t" , " % 09");
						 return str;
				 }

				 //--------	 
				  public Form1()
				 {
						 InitializeComponent();
				 }
				 //----------		
				  private void Form1_Load(object sender , EventArgs e)
				 {
						 string answer = ReadFromURL("http://www.arabteam2000.com/");

						 StreamWriter Output = new StreamWriter("C:/mypage.html");
						  Output.Write(answer);
						 // continue by this to look for the links				   
						  String[] HTTPLinks = answer.Split( ' < ' );

						 Output.Close();
						 //----------
				  }
		 }
 }

هذا الموضوع مغلق.

مواضيع مشابهة