검색결과 리스트
GET에 해당되는 글 3건
- 2018.01.10 get 방식으로 데이터 보내기
- 2016.08.22 [tips] http message test
- 2016.08.22 [Rails]Rails에서의 GET/ POST 처리 방식은 동일.
string strUri_get_stripinfos = strUri + DMCMD_get_stripinfos;
try
{
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(strUri_get_stripinfos);
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string sLine = "";
int i = 0;
while (sLine != null)
{
i++;
sLine = objReader.ReadLine();
if (sLine != null)
{
Console.WriteLine("{0}:{1}", i, sLine);
if (sLine.Contains("stripinfos") == true)
{
string response = sLine.Replace("\\", "");
response = sLine.Replace("\"", "");
response = response.Replace("{", "");
response = response.Replace("}", "");
response = response.Replace("stripinfos:", "");
response = response.Replace("[", "");
response = response.Replace("]", "");
string[] valuelist = response.Split(',');
if (valuelist.Count() > 0)
{
int selectedindex = -1;
List<string> striplist = new List<string>();
stripinfolist.Clear();
for (int k = 0; k < valuelist.Count(); k++)
{
string[] temp = valuelist[k].Split('/');
int tempvalue = 0;
StripInfo info = new StripInfo();
info.lot_number = temp[0];
striplist.Add(temp[0]);
if (temp.Length > 1 && temp[1] == "true")
{
selectedindex = k;
info.aisdefaultatportable = true;
}
if (temp.Length > 2 && int.TryParse(temp[2], out tempvalue) == true)
{
info.min_cs_A_value = tempvalue;
}
if (temp.Length > 3 && int.TryParse(temp[3], out tempvalue) == true)
{
info.max_cs_A_value = tempvalue;
}
if (temp.Length > 4 && int.TryParse(temp[4], out tempvalue) == true)
{
info.min_cs_B_value = tempvalue;
}
if (temp.Length > 5 && int.TryParse(temp[5], out tempvalue) == true)
{
info.max_cs_B_value = tempvalue;
}
stripinfolist.Add(info);
}
stripinfocombobox.IsEnabled = true;
stripinfocombobox.ItemsSource = striplist;
stripinfocombobox.SelectedIndex = selectedindex;
break;
}
else
{
}
}
}
}
}
catch (Exception err)
{
string error_msg = "서버에 접속하지 못했거나 해당 기능이 서버에 반영되지 않았습니다. \r\n접속 주소는 " + strUri_get_stripinfos + " 입니다\r\n메세지 :: " + err.Message;
LogManager.Log(3, error_msg);
stripinfocombobox.ItemsSource = null;
stripinfocombobox.IsEnabled = false;
}
http get / post 혹은 다음 방식으로 특정 서버에 메세지를 보내서
내용 확인할 수 있는 아주 좋은 사이트 하나.
get / request 예제
메세지에 대한 reponse
params
라는 이름의 해시를 통해 접근할 수 있습니다.
route.rb에서 다음과 같이 추가한다.
get 'checkversion' => 'api#checkversion'
post 'checkversion' => 'api#checkversion'
controller에서는 분기처리 없이 다음과 같이 공통 코드를 사용한다.
def checkversion
begin
logger.debug("checkversion")
ip_info = params[:ip]
#.....
end
RECENT COMMENT